`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

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

Commit messages:
 - JDK-8262841: Behavior of PhantomReference.refersTo is not well documented

Changes: https://git.openjdk.java.net/jdk17/pull/181/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=181&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262841
  Stats: 5 lines in 1 file changed: 2 ins; 2 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/181.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/181/head:pull/181

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

Reply via email to