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

8318613: ChoiceFormat patterns are not well tested #16324

Conversation

justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Oct 23, 2023

Please review this PR which adds a test for ChoiceFormat intended to test a wide range of ChoiceFormat patterns.

The existing test Bug4387255 only tests a singular basic pattern and does not test for incorrect patterns either.

The new test checks

  • both correct and incorrect patterns
  • the behavior of incorrect patterns that either throw an IllegalArgumentException or discard the incorrect portion
  • the case of formatting with an empty pattern (that leads to empty limits and formats)

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-8318613: ChoiceFormat patterns are not well tested (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16324

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 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 Oct 23, 2023
@openjdk
Copy link

openjdk bot commented Oct 23, 2023

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

  • core-libs

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

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Oct 23, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2023

Webrevs

Comment on lines 56 to 59
public void validPatternsTest(String pattern) {
assertDoesNotThrow( ()-> new ChoiceFormat(pattern),
"Valid pattern should not have thrown an exception");
}
Copy link
Member

Choose a reason for hiding this comment

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

For those valid cases, it may be helpful to actually format some edge cases, and check the results, especially for those odd ones. Or compare the parsed arrays.

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, added some code to actually compare the formatted values to the expected results as suggested.


public class PatternsTest {

private static final String err1 =
Copy link
Member

Choose a reason for hiding this comment

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

Nit: static constants should be uppercased.

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 Oct 23, 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:

8318613: ChoiceFormat patterns are not well tested

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

  • 1b15011: 8318476: Add resource consumption note to BigInteger and BigDecimal
  • 5ba9705: 8318485: Narrow klass shift should be zero if encoding range extends to 0x1_0000_0000
  • 8d9a4b4: 8317678: Fix up hashCode() for ZipFile.Source.Key
  • 69c0ae2: 8318124: JFR: Rewrite instrumentation to use Class-File API
  • c1aeac7: 8318445: More broken bailout chains in C2
  • d888b26: 8318071: IgnoreUnrecognizedVMOptions flag still causes failure in ArchiveHeapTestClass
  • bea2d48: 8312475: org.jline.util.PumpReader signed byte problem
  • 9f767aa: 8318109: Writing JFR records while a CHT has taken its lock asserts in rank checking
  • bd22d23: 8318027: Support alternative name to jdk.internal.vm.compiler
  • c2efd77: 8295795: hsdis does not build with binutils 2.39+
  • ... and 51 more: https://git.openjdk.org/jdk/compare/599560a832386d9c61aca24450d6efa65156f663...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 Oct 23, 2023
@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 25, 2023

Going to push as commit 10427c0.
Since your change was applied there have been 108 commits pushed to the master branch:

  • ca3bdfc: 8318186: ChoiceFormat inconsistency between applyPattern() and setChoices()
  • a520887: 8318487: Specification of the ListFormat.equals() method can be improved
  • cf4ede0: 8317360: Missing null checks in JfrCheckpointManager and JfrStringPool initialization routines
  • 9e98ee6: 8318735: RISC-V: Enable related hotspot tests run on riscv
  • 29d462a: 8318727: Enable parallelism in vmTestbase/vm/gc/concurrent tests
  • 43f31d7: 8318607: Enable parallelism in vmTestbase/nsk/stress/jni tests
  • cee44a6: 8318608: Enable parallelism in vmTestbase/nsk/stress/threads tests
  • b026d0b: 8312980: C2: "malformed control flow" created during incremental inlining
  • 3abd772: 8316017: Refactor timeout handler in PassFailJFrame
  • 202c013: 8318669: Target OS detection in 'test-prebuilt' makefile target is incorrect when running on MSYS2
  • ... and 98 more: https://git.openjdk.org/jdk/compare/599560a832386d9c61aca24450d6efa65156f663...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 25, 2023

@justin-curtis-lu Pushed as commit 10427c0.

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

Successfully merging this pull request may close these issues.

2 participants