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

8311663: Additional refactoring of Locale tests to JUnit #14881

Closed
wants to merge 19 commits into from

Conversation

justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Jul 13, 2023

Please review this PR which refactors more java.util.Locale tests to JUnit with some minor cleanup as well.

Although some of the files could benefit from being renamed bugNNNNNNN to something more descriptive, this makes reviewing harder, and will be handled separately.


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

Issue

  • JDK-8311663: Additional refactoring of Locale tests to JUnit (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14881

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 13, 2023

👋 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 openjdk bot added the rfr Pull request is ready for review label Jul 13, 2023
@openjdk
Copy link

openjdk bot commented Jul 13, 2023

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

mlbridge bot commented Jul 13, 2023

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.

Thanks for the conversion, Justin. Looks good overall. Some minor comments follow.

Comment on lines 53 to 56
Locale match = Locale.lookup(ranges, locales);
assertNull(match, "[Locale.lookup failed on language"
+ " range: " + ranges + " and language tags "
+ locales + "]");
Copy link
Member

Choose a reason for hiding this comment

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

Removing try-catch will lose the information on what kind of exception was thrown

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 did a second take before pushing and mistakenly removed those blocks, I knew I had left them in there originally for a reason. Fixed.

Comment on lines 65 to 70
List<LanguageRange> ranges = LanguageRange.parse("i-navajo");
Collection<Locale> locales = Collections.singleton(Locale.of("nv"));
Locale match = Locale.lookup(ranges, locales);
assertEquals(match.toLanguageTag(), "nv", "[Locale.lookup failed on language"
+ " range: " + ranges + " and language tags "
+ locales + "]");
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Comment on lines 65 to 67
@BeforeAll
static void setTurkishLocale() {
Locale.setDefault(Locale.of("tr", "TR"));
Copy link
Member

Choose a reason for hiding this comment

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

Should the tests run under othervm mode?

Arrays.stream(Locale.getAvailableLocales())
.map(Locale::toLanguageTag)
.forEach(tag -> {if(LegacyAliases.contains(tag)) {invalidTags.add(tag);}});
assertEquals(true, invalidTags.isEmpty(),
Copy link
Member

Choose a reason for hiding this comment

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

assertTrue() may fit better here


// Test number formatting for thai
@Test
public void numberTest() throws RuntimeException {
Copy link
Member

Choose a reason for hiding this comment

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

Not your change, but this throws is redundant

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review, addressed this and your other suggestions as well.

private static Stream<Arguments> shortJanuaryNames() {
return Stream.of(
Arguments.of("pa-PK", "\u0a1c\u0a28"),
Arguments.of("uz-AF" , "yan"),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Arguments.of("uz-AF" , "yan"),
Arguments.of("uz-AF", "yan"),

.map(Locale::toLanguageTag)
.forEach(tag -> {if(LegacyAliases.contains(tag)) {invalidTags.add(tag);}});
assertEquals(true, invalidTags.isEmpty(),
"Deprecated and Legacy tags found " + invalidTags + " in AvailableLocales ");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Deprecated and Legacy tags found " + invalidTags + " in AvailableLocales ");
"Deprecated and Legacy tags found " + invalidTags + " in AvailableLocales ");

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, updated this and the other suggested WS change

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.

LGTM

@openjdk
Copy link

openjdk bot commented Jul 17, 2023

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

8311663: Additional refactoring of Locale tests to JUnit

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

  • 6a09992: 8311968: Clarify Three-letter time zone IDs in java.util.TimeZone
  • 6ae152d: 8312196: ProblemList test/hotspot/jtreg/applications/ctw/modules/jdk_crypto_ec.java
  • 295ae11: 8312195: Changes in JDK-8284493 use wrong copyright syntax
  • f975be4: 8284493: Improve computeNextExponential tail performance and accuracy
  • e737968: 8308398: Move SunEC crypto provider into java.base
  • 69a46c2: 8310157: Allow void-returning filters for MethodHandles::collectCoordinates
  • 3fb9d11: 8311172: Classfile.PREVIEW_MINOR_VERSION doesn't match that read from class files
  • afcf8e4: 8290005: com/sun/jndi/ldap/LdapCBPropertiesTest.java failling with NullPointerException
  • acf591e: 8140527: JInternalFrame has incorrect title button width
  • f6e23ae: 8310201: Reduce verbose locale output in -XshowSettings launcher option
  • ... and 68 more: https://git.openjdk.org/jdk/compare/292ee630ae32c3b50363b10ffa6090e57ffef1e8...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 the ready Pull request is ready to be integrated label Jul 17, 2023
@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 19, 2023

Going to push as commit 71cac8c.
Since your change was applied there have been 120 commits pushed to the master branch:

  • aa23fd9: 8311879: SA ClassWriter generates invalid invokedynamic code
  • 6f66213: 8312014: [s390x] TestSigInfoInHsErrFile.java Failure
  • b5b6f4e: 8312164: Refactor Arrays.hashCode for long, boolean, double, float, and Object arrays
  • 14cf035: 8302987: Add uniform and spatially equidistributed bounded double streams to RandomGenerator
  • d1c788c: 8312392: ARM32 build broken since 8311035
  • c119037: 8311971: SA's ConstantPool.java uses incorrect computation to read long value in the constant pool
  • 028068a: 8312166: (dc) DatagramChannel's socket adaptor does not release carrier thread when blocking in receive
  • e7adbdb: 8311923: TestIRMatching.java fails on RISC-V
  • c6ab9c2: 8308103: Massive (up to ~30x) increase in C2 compilation time since JDK 17
  • d33e8e6: 8312200: Fix Parse::catch_call_exceptions memory leak
  • ... and 110 more: https://git.openjdk.org/jdk/compare/292ee630ae32c3b50363b10ffa6090e57ffef1e8...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 19, 2023

@justin-curtis-lu Pushed as commit 71cac8c.

💡 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
3 participants