RFR: 8351996: Behavioral updates for ClassValue::remove [v12]
Chen Liang
liach at openjdk.org
Thu May 8 16:46:00 UTC 2025
On Thu, 8 May 2025 16:19:41 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update src/java.base/share/classes/java/lang/ClassValue.java
>>
>> Co-authored-by: Shaojin Wen <shaojin.wensj at alibaba-inc.com>
>
> src/java.base/share/classes/java/lang/ClassValue.java line 463:
>
>> 461: var updated = entry.refreshVersion(classValue.version);
>> 462: if (updated != entry) {
>> 463: put(classValue.identity, updated);
>
> This appears to associate a value and contradicts the `readAccess` method name and the comment on the method that says "A simple read access to this map".
>
> Did I misunderstand what `readAccess` is meant in the context of `ClassValue` semantics?
Yep, this is unfortunately required for the cache mechanism - `refreshVersion` returns an equivalent entry, except its version is the latest, so the cache can trust this entry, if present in the cache array of a ClassValue, is up-to-date.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24043#discussion_r2080089371
More information about the core-libs-dev
mailing list