gnodet commented on issue #12591:
URL: https://github.com/apache/maven/issues/12591#issuecomment-5457537639

   Closing as invalid after investigation.
   
   The bug report's premise — that `WeakHashMap` doesn't override 
`computeIfAbsent` and therefore the operation falls through to a non-atomic 
default — is irrelevant because the **wrapper** 
(`Collections.synchronizedMap()`) does override `computeIfAbsent`.
   
   Since Java 9, `Collections.SynchronizedMap.computeIfAbsent()` acquires the 
`mutex` lock, then delegates to the underlying map's `computeIfAbsent()`, and 
releases the lock on exit. This makes the compound operation atomic with 
respect to all other operations on the same synchronized wrapper.
   
   The second `computeIfAbsent` operates on a `ConcurrentHashMap`, which is 
inherently thread-safe. No code change is needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to