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

8285405: add test and check for negative argument to HashMap::newHashMap et al #9806

Closed
wants to merge 7 commits into from

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Aug 9, 2022

(This is a recreation of a previous pull request which had received some reviews #9036. I had to delete that personal branch and recreate it due to some git issues)

Can I please get a review of this change which addresses https://bugs.openjdk.java.net/browse/JDK-8285405?


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-8285405: add test and check for negative argument to HashMap::newHashMap et al

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9806

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 9, 2022

👋 Welcome back jpai! 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.

@jaikiran
Copy link
Member Author

jaikiran commented Aug 9, 2022

Hello Stuart (@stuart-marks), as suggested by you in the pull request that you previously reviewed, I've now moved the tests to HashMap/WhiteBoxResizeTest and it now tests the new APIs using (only) -1 as the negative input.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 9, 2022
@openjdk
Copy link

openjdk bot commented Aug 9, 2022

@jaikiran 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 Aug 9, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 9, 2022

Webrevs

Copy link
Member

@ChrisHegarty ChrisHegarty 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 Aug 9, 2022

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

8285405: add test and check for negative argument to HashMap::newHashMap et al

Reviewed-by: chegar, naoto, lancea, smarks

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

  • b47438c: 8292068: Convert ModuleEntryTable into ResourceHashtable
  • 543163a: 8291978: jpackage: allow to override primary l10n files on Windows
  • 68af7c1: 8291734: Return accurate ACC_SUPER access flag for classes
  • e4925a3: 8291924: jpackage: l10n for Windows context menu label
  • 7b029ea: 8227651: Tests fail with SSLProtocolException: Input record too big
  • 35fd5d8: 8292200: Add java/io/File/GetXSpace.java to Windows problem list
  • 9825c33: 8291641: Optimize StackTraceElement.toString()
  • cb37282: 8291752: AArch64: Remove check_emit_size parameter from trampoline_call
  • 37d3146: 8289002: Minimal x86_64 VM build fails with GCC 11: 'this' pointer is null
  • ecfa38f: 8281966: Absolute path of symlink is null in JFileChooser
  • ... and 16 more: https://git.openjdk.org/jdk/compare/77398430b5e13768cddd5f63e8fe9e53735bbea8...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 Aug 9, 2022
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 as it stands.

Comment on lines 450 to 458
try {
method.apply(-1);
// expected to fail but didn't
throw new AssertionError(methodName + " was expected to throw" +
" IllegalArgumentException for param -1, but didn't");
} catch (IllegalArgumentException expected) {
// received the expected exception
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Could utilize assertThrows, instead of try-catch.

public void testNegativeNumMappings(final IntFunction<?> method, final String methodName) {
try {
method.apply(-1);
// expected to fail but didn't
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use assert.throws(IllegalArgumenException.class, () -> method.apply(-1));. which would be a bit cleaner IMHO

@jaikiran
Copy link
Member Author

jaikiran commented Aug 10, 2022

Thank you Chris, Lance and Naoto for the reviews.

I've now updated the PR to use assertThrows as suggested by Naoto and Lance. Test continues to pass.

Copy link
Member

@stuart-marks stuart-marks 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 following up on this. Looks good.

@jaikiran
Copy link
Member Author

Thank you everyone for the reviews.

@jaikiran
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 11, 2022

Going to push as commit 4b03e13.
Since your change was applied there have been 28 commits pushed to the master branch:

  • 2e0a17c: 8292187: aarch64: Remove duplicate header files
  • 36ef4c1: 8291081: Some sun/tools/jstatd/TestJstatd* tests fail with "Not a percentage: 68.31: expected true, was false"
  • b47438c: 8292068: Convert ModuleEntryTable into ResourceHashtable
  • 543163a: 8291978: jpackage: allow to override primary l10n files on Windows
  • 68af7c1: 8291734: Return accurate ACC_SUPER access flag for classes
  • e4925a3: 8291924: jpackage: l10n for Windows context menu label
  • 7b029ea: 8227651: Tests fail with SSLProtocolException: Input record too big
  • 35fd5d8: 8292200: Add java/io/File/GetXSpace.java to Windows problem list
  • 9825c33: 8291641: Optimize StackTraceElement.toString()
  • cb37282: 8291752: AArch64: Remove check_emit_size parameter from trampoline_call
  • ... and 18 more: https://git.openjdk.org/jdk/compare/77398430b5e13768cddd5f63e8fe9e53735bbea8...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 11, 2022

@jaikiran Pushed as commit 4b03e13.

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

@jaikiran jaikiran deleted the 8285405 branch August 11, 2022 06:54
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.

5 participants