On Tue, 23 Jun 2026 22:19:32 GMT, Justin Lu <[email protected]> wrote:
> Locale does not respect numeric singleton extensions. Currently `LanguageTag` > which handles singleton extension parsing only allows `alpha` characters when > it should allow `alphaNumeric`. > > This PR corrects this and adds tests for `forLanguageTag` as well as the > builder. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). Looks good, and I agree that we should just fix the issue, as it is apparently an overlook. test/jdk/java/util/Locale/LocaleEnhanceTest.java line 1074: > 1072: .toLanguageTag(); > 1073: assertEquals("en-0-foo", result, > 1074: "numeric singleton extension key should be supported"); Maybe this should be split out into a separate test case for numeric singleton round-tripping. This assertion checks `toLanguageTag()` rather than `getExtension()`, and the new test could cover both `Locale.forLanguageTag("en-0-foo").toLanguageTag()` and the `Builder#setExtension('0', ...)` path. ------------- PR Review: https://git.openjdk.org/jdk/pull/31644#pullrequestreview-4557822558 PR Review Comment: https://git.openjdk.org/jdk/pull/31644#discussion_r3463543055
