RFR: 8256167: Convert JDK use of `Reference::get` to `Reference::refersTo`

Mandy Chung mchung at openjdk.java.net
Fri Dec 4 18:12:17 UTC 2020


On Fri, 4 Dec 2020 09:19:23 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> This patch replaces some uses of `Reference::get` to `Reference::refersTo` to avoid keeping a referent strongly reachable that could cause unnecessary delay in collecting such object.   I only made change in some but not all classes in core libraries when working with Kim on `Reference::refersTo`.    The remaining uses are left for the component owners to convert at appropriate time.
>
> src/java.base/share/classes/java/util/WeakHashMap.java line 291:
> 
>> 289:         if (e.refersTo(key)) return true;
>> 290: 
>> 291:         // then checks for equality
> 
> Obnoxiously minor nit: plurality is inconsistent. `check if the given entry...` above, and `then check[s] for equality`. Should be `...then check for equality`?

OK.  Fixed this grammatical nit.

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

PR: https://git.openjdk.java.net/jdk/pull/1609


More information about the core-libs-dev mailing list