On Wed, 1 Oct 2025 21:11:53 GMT, Justin Lu <[email protected]> wrote: > 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.
Looks good. Some minor comments follow src/java.base/share/classes/sun/util/locale/LanguageTag.java line 111: > 109: > 110: // Check if the tag is a legacy tag > 111: var modern = > legacyToModern(LocaleUtils.toLowerString(languageTag)); I'd use "preferred" instead of "modern", as it is used in the RFC. test/jdk/java/util/Locale/CaseFoldLanguageTagTest.java line 112: > 110: "zh-guoyu", > 111: "i-pwn", > 112: "i-mingo" Is this intentionally randomized? Otherwise I would like it to be sorted. ------------- PR Review: https://git.openjdk.org/jdk/pull/27596#pullrequestreview-3291289066 PR Review Comment: https://git.openjdk.org/jdk/pull/27596#discussion_r2396010744 PR Review Comment: https://git.openjdk.org/jdk/pull/27596#discussion_r2396013611
