-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8316879: RegionMatches1Tests fails if CompactStrings are disabled after JDK-8302163 #15906
Conversation
👋 Welcome back avoitylov! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. I don't think a negative length should have ever been allowed in the first place, but this is Java 1.0 legacy ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
PS: I specifically like the "Looks simple and harmless" comment on the PR of the original change :)
Might be a good idea to add a simple regressions test. |
@voitylov 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:
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
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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@simonis, @rgiulietti, @RogerRiggs) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/reviewers 2 reviewer |
As Volker said, a test should be added. Also please have a maintainer working in this area review it too. |
@AlanBateman |
Co-authored-by: Raffaello Giulietti <raffaello.giulietti@oracle.com>
@rgiulietti @simonis @AlanBateman thank you for the suggestions! test/jdk/java/lang/String/RegionMatches.java was converted to testng and split into two @tests, the latter now covers 8316879. |
if (len < 0) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it also true that the regions trivial match if len == 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. The statement "there is some nonnegative integer k less than len " covers the case len == 0, and the rest of the cases are checked before this line.
Can the test use JUnit 5? JUnit is being maintained compared to TestNG. |
Mailing list message from Raffaello Giulietti on core-libs-dev: Since the tests are now TestNG, I think it would make more sense to use On 2023-09-26 16:09, Aleksei Voitylov wrote: |
I second @RogerRiggs' note that JUnit is better maintained than TestNG. |
LGTM (but I'm not an official Reviewer) |
Just out of curiosity: why not write, e.g.,
|
\u0XXX\u0XXX\u0XXX just seems harder to read, but maybe it's just me. I don't have a strong opinion on this, let me know if you believe what you suggest somehow improves readability or is more standard. |
It avoids the two The best thing would be to use |
private final byte[] b1_UTF16 = new byte[]{0x04, 0x3d, 0x04, 0x30, 0x04, 0x36, 0x04, 0x34}; | ||
private final byte[] b2_UTF16 = new byte[]{0x04, 0x32, 0x00, 0x20, 0x04, 0x41, 0x04, 0x42}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For strings, the \uxxxx version would be preferred; it is clearer that what the character is and there is less of a chance that the UTF encoding has a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the junit and unicode encoding changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not an official Reviewer)
/integrate |
Thanks everyone for prompt reviews! Could someone sponsor this? I also intend to backport to 21u soon. |
/sponsor |
Going to push as commit cfcbfc6.
Your commit was automatically rebased without conflicts. |
@RogerRiggs @voitylov Pushed as commit cfcbfc6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/backport jdk21u |
@voitylov the backport was successfully created on the branch voitylov-backport-cfcbfc6c in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u:
|
test java.lang.String.RegionMatches1Tests fails on all platforms with -XX:-CompactStrings option and on ARM32 where Compact Strings is disabled by default. The fix is to return true immediately if len is negative, since for negative length this condition will never be satisfied.
Testing: JCK, JTREG passed with the fix with -XX:-CompactStrings on x86_64 and on ARM32.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15906/head:pull/15906
$ git checkout pull/15906
Update a local copy of the PR:
$ git checkout pull/15906
$ git pull https://git.openjdk.org/jdk.git pull/15906/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15906
View PR using the GUI difftool:
$ git pr show -t 15906
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15906.diff
Webrev
Link to Webrev Comment