RFR (XS) 8145539: (coll) AbstractMap.keySet and .values should not be volatile

Aleksey Shipilev aleksey.shipilev at oracle.com
Thu Dec 17 13:46:06 UTC 2015


Hi Peter,

On 12/17/2015 03:19 PM, Peter Levart wrote:
> Wouldn't that change make a possible outcome of keySet() returning null
> in case it was invoked concurrently? Wouldn't you have to use a local
> variable to prevent that?

Ah yes! Silly me. I remember looking at most usages and seeing that
reads are performed only once, but missed that it should be applied
consistently, including the AbstractMap itself.

Fixed that, plus exploded inline assignments in subclasses :
 http://cr.openjdk.java.net/~shade/8145539/webrev.03/

Thanks,
-Aleksey




More information about the core-libs-dev mailing list