<i18n dev> RFR: 8368981: Case Fold Locale Legacy Tags On Demand

Justin Lu jlu at openjdk.org
Wed Oct 1 21:17:37 UTC 2025


Please review this PR which case folds grandfathered BCP47 tags on demand. (Instead of keeping the case compliant versions stored.)

This facilitates the cleanup of the `LEGACY` map (which contains a String to String Array mapping). The 2D String array, creation and populating of the  `LEGACY` map, as well as lower case folding of the legacy tags can now be removed from the static block of _sun.util.locale.LanguageTag_.

Legacy tags are a small subset compared to the entire set of valid BCP47 tags. Reducing the cost for supporting them would be ideal. Instead, legacy tags can now be checked against and folded on demand via a switch statement.

The commented grandfathered syntax is removed because the values themselves already exist as code, and the exact case can be found in the provided RFC link.

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

Commit messages:
 - Bolstering case folding test cases for legacy tags
 - inline 'potentialLegacy' and 'modern'
 - init

Changes: https://git.openjdk.org/jdk/pull/27596/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27596&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8368981
  Stats: 208 lines in 2 files changed: 100 ins; 90 del; 18 mod
  Patch: https://git.openjdk.org/jdk/pull/27596.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27596/head:pull/27596

PR: https://git.openjdk.org/jdk/pull/27596


More information about the i18n-dev mailing list