On Thu, 7 Aug 2025 21:00:48 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Ah, OK, so this is already slow path, good. But are we sure overwriting 
>> cache entry _with (the live version of) itself_ would not break things? 
>> Looking at `addToCache` implemenation, I am not 100% convinced it is safe. 
>> Please check?
>
> This was the code on JDK 24 GA:
> https://github.com/openjdk/jdk/blob/6705a9255d28f351950e7fbca9d05e73942a4e27/src/java.base/share/classes/java/lang/ClassValue.java#L458-L468
> 
> This fix is essentially the same as the previous. The cache entry + version 
> is like a bloom filter: if it exists and the version is right, we can ensure 
> we get the right item. A cache entry with an invalid version is essentially 
> invalid, but it stays in the cache unless accessed by cache update requests. 
> Yes I know this may constitute a resource leak, which is tracked by 
> https://bugs.openjdk.org/browse/JDK-8352622.

OK, thanks, that is convincing.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26679#discussion_r2262324768

Reply via email to