-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8301120: Cleanup utility classes java.util.Arrays and java.util.Collections #12207
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
Conversation
👋 Welcome back tvaleev! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -1067,7 +1065,7 @@ public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c | |||
public String toString() {return c.toString();} | |||
|
|||
public Iterator<E> iterator() { | |||
return new Iterator<E>() { | |||
return new Iterator<>() { |
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.
Interesting, this whole family of changes is now possible because the original version of diamond didn't allow it to be used in the context of an anonymous inner class, because of non-denotability of types or some such. That restriction has been relaxed, but we never went back to fix these up.
I also note think that Martin objected to this sort of change in java.util.concurrent, but I'm OK with it here.
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, the improved version of diamond was
JDK-8062373: Project Coin: diamond and anonymous classes
as part of JEP 213.
UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) { | ||
// Need to cast to raw in order to work around a limitation in the type system | ||
super((Set)s); | ||
super((Set<Map.Entry<K, V>>)s); |
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.
Huh, good catch, there doesn't appear to be a "limitation in the type system" here, either currently or in older versions of javac going back to JDK 7.
(o instanceof ReverseComparator2 && | ||
cmp.equals(((ReverseComparator2)o).cmp)); | ||
(o instanceof ReverseComparator2<?> that && | ||
cmp.equals(that.cmp)); |
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, using an instanceof pattern where we had missed it previously.
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.
Overall looks good, no changes necessary, comments are just observations.
I'll come back and approve this when my CI build finishes.
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.
Test run looks good, ok to integrate.
@amaembo 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 46 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 |
/integrate |
Going to push as commit ae0e76d.
Your commit was automatically rebased without conflicts. |
number of minor cleanups could be done in Arrays and Collections utility classes.
In Arrays:
In Collections:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12207/head:pull/12207
$ git checkout pull/12207
Update a local copy of the PR:
$ git checkout pull/12207
$ git pull https://git.openjdk.org/jdk pull/12207/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12207
View PR using the GUI difftool:
$ git pr show -t 12207
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12207.diff