Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8308108: Support Unicode extension for collation settings #14040

Closed
wants to merge 5 commits into from

Conversation

naotoj
Copy link
Member

@naotoj naotoj commented May 17, 2023

This change intends to interpret the BCP47 U extension wrt collation settings in the given Locale, then applies them to the created instances in the 1-arg factory method in Collator. A corresponding CSR has also been drafted.


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-8308243 to be approved

Issues

  • JDK-8308108: Support Unicode extension for collation settings
  • JDK-8308243: Support Unicode extension for collation settings (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14040

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 17, 2023

👋 Welcome back naoto! 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 openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels May 17, 2023
@openjdk
Copy link

openjdk bot commented May 17, 2023

@naotoj 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 core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org labels May 17, 2023
@mlbridge
Copy link

mlbridge bot commented May 17, 2023

Webrevs

Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
Copy link
Member

@irisclark irisclark 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.

Associated CSR also Reviewed.

Comment on lines 233 to 236
* will have the specified strength and/or decomposition respectively. If the specified
* setting value is not recognized, strength and/or decomposition will not be
* overridden.
* @apiNote Implementations of {@code Collator} class may produce
Copy link
Contributor

Choose a reason for hiding this comment

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

The API should identify the valid values for ks and kk and the corresponding values as passed to setStrength and setDecomposition.

Copy link
Contributor

@RogerRiggs RogerRiggs 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

@openjdk
Copy link

openjdk bot commented May 18, 2023

@naotoj 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:

8308108: Support Unicode extension for collation settings

Reviewed-by: iris, rriggs, jlu, alanb

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 149 new commits pushed to the master branch:

  • 89b3c37: 8307125: compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java hits assert(!Continuation::is_frame_in_continuation(thread(), fr())) failed: No support for deferred values in continuations
  • 98acce1: 8306703: JFR: Summary views
  • 534de6d: 8300491: SymbolLookup::libraryLookup accepts strings with terminators
  • 48d21bd: 8286597: Implement PollerProvider on AIX
  • e7edf8d: 8300038: Make new version of JNU_GetStringPlatformChars which checks for null characters
  • 90e57fd: 8308335: JFR: Remove @experimental from Virtual Threads events
  • 7e2e05d: 8308098: G1: Remove redundant checks in G1ObjectCountIsAliveClosure
  • 2599ada: 8308655: Narrow types of ConstantPool and ConstMethod returns
  • 5a0a238: 8308746: C2 IR test failures for TestFpMinMaxReductions.java with SSE2
  • 38367d3: 8308735: Typos in parameter names
  • ... and 139 more: https://git.openjdk.org/jdk/compare/f9a785e855287ff6746ac8dc8f8f2e2f90c5be07...master

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 added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels May 18, 2023
* </tbody>
* </table>
* If the specified setting value is not recognized, strength and/or
* decomposition will not be overridden.
Copy link
Contributor

@AlanBateman AlanBateman May 19, 2023

Choose a reason for hiding this comment

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

The proposed update looks okay except for the last part "If the specified setting value is not recognized, strength and/or decomposition will not be overridden". I thin this could be clearer.
If I understand correctly, if the Unicode locale type for the given Locale might have a strength level and decomposition mode and this method makes a best effort to return a Collator with the expected level and mode. If so, then I think the javadoc needs to make this a bit clearer. Also, if the factory method returns a Collator that doesn't do what I asked, can I call setStrength/setDecomposition to change it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there is any chance that the factory method returns a Collator that fails to meet the settings in the locale, because setStrength()/setDecompositon() with valid values never fail. So the returned instance will always have the requested strength/decomposition. Does this answer your question?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is any chance that the factory method returns a Collator that fails to meet the settings in the locale, because setStrength()/setDecompositon() with valid values never fail. So the returned instance will always have the requested strength/decomposition. Does this answer your question?

It's the last sentence that bothers me. I understand the setters can't fail but the last sentence of the proposed text makes it sound like invalid settings will be just ignored. So I think this sentence needs to be re-examined as I don't think I understand what it is trying to say now.

Copy link
Member

Choose a reason for hiding this comment

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

IIUC that's already the existing behavior for any Unicode extension.

Example,

Locale enIsoLoc = Locale.forLanguageTag("en-u-fw-mon");
WeekFields.of(enIsoLoc).getFirstDayOfWeek(); // MONDAY
Locale badExtension = Locale.forLanguageTag("en-u-fw-zzz");
WeekFields.of(badExtension).getFirstDayOfWeek(); // SUNDAY

If the value for a Unicode extension is invalid, they are simply ignored. In this case 'zzz' is not recognized and thus can not overhaul the first day of the week.

Copy link
Member

@justin-curtis-lu justin-curtis-lu left a comment

Choose a reason for hiding this comment

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

LGTM

@AlanBateman
Copy link
Contributor

I went through the latest javadoc but the last sentence is still confusing. I think the part that is missing is the method doesn't make it clear up front that it gets requested locale and then attempts to set its strength and decomposition if recognized. If this were clear in the first part of the method description then it is okay to say that the returned Collator might not have the expected strength and decomposition.

@naotoj
Copy link
Member Author

naotoj commented May 22, 2023

Thanks, Alan. Clarified the method doc based on your suggestion.

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

Thanks for persisting with this to get the wording clear, the latest version looks good.

@openjdk openjdk bot added csr Pull request needs approved CSR before integration ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated csr Pull request needs approved CSR before integration labels May 24, 2023
@naotoj
Copy link
Member Author

naotoj commented May 25, 2023

/integrate

@openjdk
Copy link

openjdk bot commented May 25, 2023

Going to push as commit 27ba8bd.
Since your change was applied there have been 149 commits pushed to the master branch:

  • 89b3c37: 8307125: compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java hits assert(!Continuation::is_frame_in_continuation(thread(), fr())) failed: No support for deferred values in continuations
  • 98acce1: 8306703: JFR: Summary views
  • 534de6d: 8300491: SymbolLookup::libraryLookup accepts strings with terminators
  • 48d21bd: 8286597: Implement PollerProvider on AIX
  • e7edf8d: 8300038: Make new version of JNU_GetStringPlatformChars which checks for null characters
  • 90e57fd: 8308335: JFR: Remove @experimental from Virtual Threads events
  • 7e2e05d: 8308098: G1: Remove redundant checks in G1ObjectCountIsAliveClosure
  • 2599ada: 8308655: Narrow types of ConstantPool and ConstMethod returns
  • 5a0a238: 8308746: C2 IR test failures for TestFpMinMaxReductions.java with SSE2
  • 38367d3: 8308735: Typos in parameter names
  • ... and 139 more: https://git.openjdk.org/jdk/compare/f9a785e855287ff6746ac8dc8f8f2e2f90c5be07...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 25, 2023
@openjdk openjdk bot closed this May 25, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 25, 2023
@openjdk
Copy link

openjdk bot commented May 25, 2023

@naotoj Pushed as commit 27ba8bd.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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 integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

6 participants