<i18n dev> RFR: 8316557: Make fields final in 'sun.util' package

Per Minborg pminborg at openjdk.org
Mon Nov 13 11:45:06 UTC 2023


On Thu, 14 Sep 2023 08:58:56 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> A few classes in `sun.util` package have non-final fields which could easily be marked `final`.

src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java line 48:

> 46: public class CLDRCalendarDataProviderImpl extends CalendarDataProviderImpl {
> 47: 
> 48:     private static final Map<String, Integer> firstDay = new ConcurrentHashMap<>();

We might rename these fields to FIRST_DAY etc.

src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java line 63:

> 61: 
> 62:     // parent locales map
> 63:     private static final Map<Locale, Locale> parentLocalesMap;

Rename to PARENT_LOCALES_MAP?

src/java.base/share/classes/sun/util/locale/LocaleObjectCache.java line 102:

> 100:     }
> 101: 
> 102:     private static class CacheEntry<K, V> extends SoftReference<V> {

The class itself might be `final`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15736#discussion_r1391002631
PR Review Comment: https://git.openjdk.org/jdk/pull/15736#discussion_r1391004183
PR Review Comment: https://git.openjdk.org/jdk/pull/15736#discussion_r1391005224


More information about the i18n-dev mailing list