On Wed, 6 Dec 2023 08:14:05 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Currently, Locale-related system properties, such as `user.language` or 
>> `user.country`, are initialized when the `Locale` class is loaded. Making 
>> them static properties is safer than relying on the `Locale` class loading 
>> timing, which could potentially be changed depending on the implementation.
>
> src/java.base/share/classes/java/util/Locale.java line 1099:
> 
>> 1097:             StaticProperty.userCountry(category.ordinal() + 1),
>> 1098:             StaticProperty.userVariant(category.ordinal() + 1),
>> 1099:             
>> getDefaultExtensions(StaticProperty.userExtensions(category.ordinal() + 1))
> 
> I suspect this would be more readable, and maintainable, if you add 
> non-public languageKey/scriptKey/countryKey/variantKey methods to 
> Locale.Category. That would change this to 
> getInstance(category.languageKey(), ...) so no sight of the ordinal at the 
> use-site.

Right. Will change it in the next iteration

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16986#discussion_r1417769586

Reply via email to