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

Mandy Chung mchung at openjdk.java.net
Wed Jun 30 22:47:02 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

This pull request has now been integrated.

Changeset: 9ac63a6e
Author:    Mandy Chung <mchung at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17/commit/9ac63a6e08c18ed99b97fe0abcc0ac51b96a563e
Stats:     5 lines in 1 file changed: 2 ins; 2 del; 1 mod

8262841: Clarify the behavior of PhantomReference::refersTo

Reviewed-by: kbarrett, rriggs

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

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


More information about the core-libs-dev mailing list