JDK-8336300 : DateFormatSymbols#getInstanceRef returns non-cached instance
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 8,11,17,21,23
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2024-07-12
  • Updated: 2024-07-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
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.