RFR: 8341923: java.util.Locale class specification improvements [v3]

Naoto Sato naoto at openjdk.org
Wed Nov 20 18:33:36 UTC 2024


On Wed, 20 Nov 2024 02:58:45 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/Locale.java line 144:
>> 
>>> 142:  *   each indicating its own semantics, these values should be ordered
>>> 143:  *   by importance, with most important first, separated by
>>> 144:  *   underscore('_').  The variant field is case sensitive.</dd>
>> 
>> This part "separated by underscore('_')" is missing in the revised doc
>
> I intentionally omitted this because
> 
> - I thought it was redundant as the syntax already follows a few lines below.
> - The `Locale` syntax allows both `_` and  `-`, not just `_`.
> 
> However, if you think it should remain, I'll restore it as `separated by ('_'|'-')`.

I was thinking how to parse "XX_YY-Z" variant. Since it is not well-formed subtags in BCP 47 definition, it should be delimited by `_` so there would be two values, "XX" and "YY-Z" according to the current spec. However, I understand that the implementation treats '_' and '-' equally both for well-formed and ill-formed variant values, I think it's better to put `separated by ('_'|'-')` to remedy the spec.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22192#discussion_r1850781651


More information about the core-libs-dev mailing list