On Tue, 28 Jul 2026 12:26:05 GMT, Per Minborg <[email protected]> wrote:

> This PR proposes to add comments in `LazyConstants.Mutexes` so that it 
> becomes more evident where we have `volatile` access.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.base/share/classes/java/util/LazyCollections.java line 606:

> 604:                 // there was at least one unchecked exception thrown by 
> the
> 605:                 // computing function.
> 606:                 return null;

The comment above is outdated? since acquireMutex can return 
[null](https://github.com/openjdk/jdk/commit/3412d4c0dd5250f14cc6fe594355bdf2ff976417)
 if:
> final Object mutex = mutexes.acquireMutex(offset);
> if (mutex == null) {
>    // There might be a race where the value is already computed and
>    // the mutex is cleared, so we need to re-check the value again

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32069#discussion_r3670033733

Reply via email to