Skip to content

Conversation

@justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Oct 20, 2025

Please review this PR which is a first stab at clarifying the behavior of duplicate variants, extension singletons, and U extension keys and attributes for BCP47 subtags in the Locale specification. This is a follow up to https://bugs.openjdk.org/browse/JDK-8369739.

Changes are made under the BCP47 and U extension sections that define "well-formed" in the class description.
Additionally, changes are made under the relevant Locale and Locale.Builder methods themselves.

Will update the CSR accordingly when the proposed wording changes are finalized.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8370255 to be approved

Issues

  • JDK-8370250: Locale should mention the behavior for duplicate subtags (Bug - P4)
  • JDK-8370255: Locale should mention the behavior for duplicate subtags (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27909/head:pull/27909
$ git checkout pull/27909

Update a local copy of the PR:
$ git checkout pull/27909
$ git pull https://git.openjdk.org/jdk.git pull/27909/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27909

View PR using the GUI difftool:
$ git pr show -t 27909

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27909.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 20, 2025

👋 Welcome back jlu! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 20, 2025

@justin-curtis-lu This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8370250: Locale should mention the behavior for duplicate subtags

Reviewed-by: naoto

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 66 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title JDK-8370250: Locale should mention the behavior for duplicate subtags 8370250: Locale should mention the behavior for duplicate subtags Oct 20, 2025
@openjdk openjdk bot added csr Pull request needs approved CSR before integration core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org labels Oct 20, 2025
@openjdk
Copy link

openjdk bot commented Oct 20, 2025

@justin-curtis-lu The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 20, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 20, 2025

Webrevs

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left a couple of comments. Also we might want to add RFC 6067 for reference.

Comment on lines 252 to 253
* form as a locale type subtag). {@code Locale} does not enforce uniqueness of
* locale keys nor attributes. For methods in {@code Locale} and {@code Locale.Builder}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be misleading as we are enforcing uniqueness, by ignoring the duplicates. The validity is what is not enforced here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

* However, duplicate extension singleton keys and their associated type
* are accepted but ignored. The same behavior applies to duplicate locale
* keys and attributes within a U extension.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Note that..." in the prior occurence of this wording might apply here for consistency.

Copy link
Member Author

@justin-curtis-lu justin-curtis-lu Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think explicity specifying the note would not hurt here, otherwise missing "note" might unnecessarilly make readers wonder why

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated wording looks good

@justin-curtis-lu
Copy link
Member Author

@naotoj The CSR is now updated with the proposed wording.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants