RFR: 8351045: ClassValue::remove cannot ensure computation observes up-to-date state [v2]

Chen Liang liach at openjdk.org
Wed Mar 5 15:19:28 UTC 2025


On Tue, 4 Mar 2025 19:17:57 GMT, John R Rose <jrose at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Improve docs
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/classvalue-remove
>>  - 8351045: ClassValue::remove cannot ensure computation observes up-to-date state
>
> src/java.base/share/classes/java/lang/ClassValue.java line 504:
> 
>> 502:             Entry<?> e = remove(classValue.identity);
>> 503:             // e == null: Uninitialized, and no pending calls to computeValue.
>> 504:             // remove didn't change anything.  No change.
> 
> Please capitalize the sentence: "Remove didn't…"
> Also "Remove and discard" instead of "remove discarded".
> Perhaps (this is being very picky) "Inside finishEntry, the logic will retry when it discovers the promise is removed."
> 
> This is a good bug fix.  Thanks for finding it.

`remove` refers to the `WeakHashMap.remove(identity)` call. Clarified by using `remove(identity)` instead of just "remove".

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23866#discussion_r1981603956


More information about the core-libs-dev mailing list