On Mon, 6 Jun 2022 14:36:03 GMT, Сергей Цыпанов <d...@openjdk.java.net> wrote:

>> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
>> volatile, even in case of race in the worst case it is recalculated at most 
>> once per thread
>> - `defaultLocale` field is read multiple times in `initDefault()`
>> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
>> - `languageTag` is read twice in `toLanguageTag()`
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8287860: Mark hash fields with @Stable

src/java.base/share/classes/java/util/Locale.java line 1084:

> 1082:         Properties props = GetPropertyAction.privilegedGetProperties();
> 1083: 
> 1084:         Locale defaultLocale = Locale.defaultLocale;

I'd use a different local variable name so that it won't clash with the field 
name. The same holds for other locations (`isoLanguages` and `languageTag`)

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

PR: https://git.openjdk.java.net/jdk/pull/9041

Reply via email to