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
8132984: incorrect type for Reference.discovered #1897
Conversation
|
@kimbarrett |
@kimbarrett Setting summary to |
Webrevs
|
Hi Kim, If you introduce a private method in Reference:
...and use it Reference.processPendingReferences while loop like this:
Then you can keep the signature of But what you have is OK and much better than what was before. |
Mailing list message from Kim Barrett on core-libs-dev:
Nice! And this reverts all changes to ReferenceQueue.java
Thanks, but I?m going to take your improvement. I?ll update the PR once I?ve re-run some tests. |
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 to me!
@kimbarrett This change now passes all automated pre-integration checks. 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 no new commits pushed 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.
This looks good.
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 @plevart , @rkennke , @RogerRiggs , and @mlchung for reviews. |
/summary Use unbounded wildcard placeholders, plus a new helper to get back to the Reference domain. |
@kimbarrett Updating existing summary to |
/integrate |
@kimbarrett Pushed as commit 33dcc00. |
Please review this change which fixes the type of the private
Reference.discovered field. It was Reference, but that's wrong because
it can be any Reference object.
I've changed it to Reference and let that flow through, updating some other variables that were previously somewhat incorrectly typed (usually with an Object type parameter). The interesting change is to the ReferenceQueue.enqueue parameter, which is now also Reference.
This ultimately end up with a provably safe and correct, but uncheckable,
cast in ReferenceQueue.enqueue.
An alternative might be to use a raw type for the discovered field, but I
think that ends up with more @SuppressWarnings of various flavors. I think
the unbounded wildcard approach is clearer and cleaner.
Note that all of the pending list handling, including the discovered field,
could be moved into a non-public, non-generic, sealed(?) base class of
Reference. The pending list handling has nothing to do with the generic
parameter T.
Testing:
mach5 tier1 and tier4 (tier4 is where vmTestbase_vm_gc_ref tests are run)
/label core-libs
/summary Use unbounded wildcard placeholders and final safe but unchecked cast.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1897/head:pull/1897
$ git checkout pull/1897