RFR: JDK-8310913 Move ReferencedKeyMap to jdk.internal so it may be shared [v3]

Jim Laskey jlaskey at openjdk.org
Thu Jul 6 12:11:06 UTC 2023


On Wed, 5 Jul 2023 19:33:28 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update to use VirtualThread friendly stale queue.
>
> `WeakReferenceKey::equals` and `SoftReferenceKey::equals`:
> 
> Instead of `return Objects.equals(get(), obj);`, suggest to do:
> 
> 
>     return refersTo(obj);

@mlchung Not sure I catch the nuance. `refersTo` doesn't work if the search key is constructed. For example, if the key reference is a `record Pair(int a, int b) {}`, then `map.containsKey(new Pair(10, 20))` would locate with equals but not with `refersTo`.

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

PR Comment: https://git.openjdk.org/jdk/pull/14684#issuecomment-1623568281


More information about the core-libs-dev mailing list