Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8336300

DateFormatSymbols#getInstanceRef returns non-cached instance

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 8, 11, 17, 21, 23
    • core-libs
    • 8
    • b07

      Javadoc of 'java.text.DateFormatSymbols#getInstanceRef' states that this method is supposed to return cached instance. Not clone, like its brother-method 'java.text.DateFormatSymbols#getInstance(java.util.Locale)'.
      But it's the case anymore (after changes from JEP 127). Actual implementation of both methods is the same:

          public static final DateFormatSymbols getInstance(Locale locale) {
              DateFormatSymbols dfs = getProviderInstance(locale);
              if (dfs != null) {
                  return dfs;
              }
              throw new RuntimeException("DateFormatSymbols instance creation failed.");
          }

      We should either remove redundant 'getInstanceRef' method and use 'getInstance' directly. Or fix implementation to return not-cloned instance.

            naoto Naoto Sato
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: