<i18n dev> RFR: JDK-8282625 Formatter caches Locale/DecimalFormatSymbols poorly [v3]
Roger Riggs
rriggs at openjdk.java.net
Fri Mar 4 21:26:00 UTC 2022
On Fri, 4 Mar 2022 20:00:54 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> I am afraid people are still using constructors for creating a locale, instead of the factory method that was added later. Since `new Locale("en") == new Locale("en")` returns `false`, I'd still expect `equals()` to compare locales. As to the constants, the number of them is relatively small, IMO.
>
> As a separate/future issue, perhaps the constructors should be deprecated to nudge people to using the static `getInstance` methods.
Would it be just as effective and improve performance more broadly to cache in DecimalFormatSymbols.getInstance()?
Declarations should be private unless there is a package need.
In this case, the only access to should be via the method.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7703
More information about the i18n-dev
mailing list