-
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
8285405: add test and check for negative argument to HashMap::newHashMap et al #9806
Conversation
…shSet and LinkedHashSet
👋 Welcome back jpai! A progress list of the required criteria for merging this PR into |
Hello Stuart (@stuart-marks), as suggested by you in the pull request that you previously reviewed, I've now moved the tests to |
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.
LGTM
@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:
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
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 |
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 as it stands.
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 | ||
} | ||
} |
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.
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 |
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.
You could use assert.throws(IllegalArgumenException.class, () -> method.apply(-1));
. which would be a bit cleaner IMHO
Thank you Chris, Lance and Naoto for the reviews. I've now updated the PR to use |
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.
Thanks for following up on this. Looks good.
Thank you everyone for the reviews. |
/integrate |
Going to push as commit 4b03e13.
Your commit was automatically rebased without conflicts. |
(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
Issue
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