RFR: 8017088 : (s) Map/HashMap.compute() incorrect with key mapping to null value
mike.duigou at oracle.com
Thu Jun 20 00:22:04 UTC 2013
This is a fix to the Map.compute() default method and HashMap.compute() implementation to correct the handling of keys mapped to null values when the function returns null. This situation should result in the key being removed but it was not.
I am strongly considering moving all of the current looping defaults in Map to ConcurrentMap and replacing them with implementations which throw ConcurrentModificationException rather than retrying. The current implementation of Map.compute() default comes close to breaking atomicity by adding the containsKey() check. (It doesn't because the subsequent remove() when oldValue = null can't succeed for any known ConcurrentMap implementations).
More information about the core-libs-dev