On Mon, 20 Oct 2025 23:28:29 GMT, Naoto Sato <[email protected]> wrote:
>> Justin Lu has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Reflect Naoto's review
>
> src/java.base/share/classes/java/util/Locale.java line 253:
>
>> 251: * {@code [0-9a-zA-Z]{3,8}} (it is a single subtag with the same
>> 252: * form as a locale type subtag). {@code Locale} does not enforce
>> uniqueness of
>> 253: * locale keys nor attributes. For methods in {@code Locale} and {@code
>> Locale.Builder}
>
> This could be misleading as we are enforcing uniqueness, by ignoring the
> duplicates. The validity is what is not enforced here.
Good point. I updated that sentence. I held off on using "valid" because while
rfc5646 mentions duplicates being "invalid", rfc6067 simply mentions that
duplicates have no meaning.
> src/java.base/share/classes/java/util/Locale.java line 2736:
>
>> 2734: * are accepted but ignored. The same behavior applies to
>> duplicate locale
>> 2735: * keys and attributes within a U extension.
>> 2736: *
>
> "Note that..." in the prior occurence of this wording might apply here for
> consistency.
`Locale.forLanguageTag` is specified to _ignore subsequent subtags on
ill-formed input_, so a heads up is warranted. Since
`Lcoale.Builder.setLanguageTag` either throws or does not (and duplicate tags
do not throw), I think it is implied subsequent subtags are processed. However,
that's just my opinion, if you think it is not obvious, I will add it in.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27909#discussion_r2448963024
PR Review Comment: https://git.openjdk.org/jdk/pull/27909#discussion_r2448963157