|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
102 | 102 | import sun.util.locale.provider.LocaleProviderAdapter;
|
103 | 103 | import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
104 | 104 | import sun.util.resources.LocaleData;
|
105 |
| -import sun.util.resources.ParallelListResourceBundle; |
106 | 105 |
|
107 | 106 | /**
|
108 | 107 | * LocalizationFeature is the core class of SVM localization support. It contains all the options
|
@@ -159,10 +158,7 @@ public class LocalizationFeature implements InternalFeature {
|
159 | 158 |
|
160 | 159 | private Function<String, Class<?>> findClassByName;
|
161 | 160 |
|
162 |
| - private Field baseLocaleCacheField; |
163 |
| - private Field localeCacheField; |
164 | 161 | private Field candidatesCacheField;
|
165 |
| - private Field localeObjectCacheMapField; |
166 | 162 | private Field langAliasesCacheField;
|
167 | 163 | private Field parentLocalesMapField;
|
168 | 164 | @Platforms(Platform.HOSTED_ONLY.class) private ImageClassLoader imageClassLoader;
|
@@ -291,9 +287,6 @@ public void duringSetup(DuringSetupAccess a) {
|
291 | 287 | }
|
292 | 288 | langAliasesCacheField = access.findField(CLDRLocaleProviderAdapter.class, "langAliasesCache");
|
293 | 289 | parentLocalesMapField = access.findField(CLDRLocaleProviderAdapter.class, "parentLocalesMap");
|
294 |
| - baseLocaleCacheField = access.findField("sun.util.locale.BaseLocale$1InterningCache", "CACHE"); |
295 |
| - localeCacheField = access.findField("java.util.Locale$LocaleCache", "LOCALE_CACHE"); |
296 |
| - localeObjectCacheMapField = null; |
297 | 290 | candidatesCacheField = access.findField("java.util.ResourceBundle$Control", "CANDIDATES_CACHE");
|
298 | 291 |
|
299 | 292 | String reason = "All ResourceBundleControlProvider that are registered as services end up as objects in the image heap, and are therefore registered to be initialized at image build time";
|
@@ -346,27 +339,11 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
|
346 | 339 | @Override
|
347 | 340 | public void duringAnalysis(DuringAnalysisAccess a) {
|
348 | 341 | DuringAnalysisAccessImpl access = (DuringAnalysisAccessImpl) a;
|
349 |
| - scanLocaleCache(access, baseLocaleCacheField); |
350 |
| - scanLocaleCache(access, localeCacheField); |
351 |
| - scanLocaleCache(access, candidatesCacheField); |
| 342 | + access.rescanRoot(candidatesCacheField); |
352 | 343 | access.rescanRoot(langAliasesCacheField);
|
353 | 344 | access.rescanRoot(parentLocalesMapField);
|
354 | 345 | }
|
355 | 346 |
|
356 |
| - private void scanLocaleCache(DuringAnalysisAccessImpl access, Field cacheFieldField) { |
357 |
| - access.rescanRoot(cacheFieldField); |
358 |
| - |
359 |
| - Object localeCache; |
360 |
| - try { |
361 |
| - localeCache = cacheFieldField.get(null); |
362 |
| - } catch (ReflectiveOperationException ex) { |
363 |
| - throw VMError.shouldNotReachHere(ex); |
364 |
| - } |
365 |
| - if (localeCache != null && localeObjectCacheMapField != null) { |
366 |
| - access.rescanField(localeCache, localeObjectCacheMapField); |
367 |
| - } |
368 |
| - } |
369 |
| - |
370 | 347 | @Platforms(Platform.HOSTED_ONLY.class)
|
371 | 348 | private static Set<Locale> processLocalesOption() {
|
372 | 349 | Set<Locale> locales = new HashSet<>();
|
@@ -507,10 +484,6 @@ protected void addResourceBundles() {
|
507 | 484 | prepareNegativeBundle(ConfigurationCondition.alwaysTrue(), baseName, locale, true);
|
508 | 485 | continue; /* No bundle for this `locale`. */
|
509 | 486 | }
|
510 |
| - if (bundle instanceof ParallelListResourceBundle) { |
511 |
| - /* Make sure the `bundle` content is complete. */ |
512 |
| - localeData.setSupplementary((ParallelListResourceBundle) bundle); |
513 |
| - } |
514 | 487 | prepareJDKBundle(bundle, locale);
|
515 | 488 | }
|
516 | 489 | }
|
|
0 commit comments