[jdk17] RFR: JDK-8262841: Clarify the behavior of PhantomReference::refersTo

Roger Riggs rriggs at openjdk.java.net
Wed Jun 30 20:03:05 UTC 2021


On Wed, 30 Jun 2021 16:49:44 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> `Reference::refersTo` behaves the same for soft, weak, and phantom references whereas `PhantomReference::get` always returns `null` which is different than soft and weak references. 
> 
> This patch clarifies the specification of `PhantomReference` to make it clear that `refersTo` can be used for phantom references.  With `refersTo`, phantom references if not registered in a reference queue are not completely useless.  Update the javadoc of the constructor to reflect that.
> 
> I created a CSR to document this spec clarification:
>    https://bugs.openjdk.java.net/browse/JDK-8269688

Marked as reviewed by rriggs (Reviewer).

-------------

PR: https://git.openjdk.java.net/jdk17/pull/181


More information about the core-libs-dev mailing list