On Tue, 5 Dec 2023 23:04:55 GMT, Naoto Sato <na...@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 class initialization > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16986#discussion_r1416885432