RFR: 8188055: (ref) Add Reference::refersTo predicate

Kim Barrett kim.barrett at oracle.com
Thu Oct 8 07:56:33 UTC 2020


> On Oct 6, 2020, at 5:22 AM, Daniel Fuchs <dfuchs at openjdk.java.net> wrote:
> 
> On Tue, 6 Oct 2020 00:04:11 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/ref/Reference.java line 361:
>> 
>>> 359:
>>> 360:     /* Type-erased implementation of refersTo(). */
>>> 361:     native boolean refersTo0(Object o);
>> 
>> Is there any reason why it can't use the parameter type like `refersTo0(T o)`?  Same for `PhantomReference::refersTo0(T
>> o)`
> 
> But should `refersTo` takes a `T`? I mean - if I have a `Reference<?> ref`, the compiler will not let me query
> `ref.refersTo(o)`; is this what we want?

I'm going to have to defer to the Java language experts on this question.  Mandy?  Alan?



More information about the core-libs-dev mailing list