RFR (XS) 8145539: (coll) AbstractMap.keySet and .values should not be volatile
Aleksey Shipilev
aleksey.shipilev at oracle.com
Thu Dec 17 22:45:57 UTC 2015
On 12/17/2015 08:21 PM, Paul Sandoz wrote:
>> On 17 Dec 2015, at 16:54, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
>> On 12/17/2015 06:07 PM, Doug Lea wrote:
>>> On 12/16/2015 05:53 PM, Aleksey Shipilev wrote:
>>>> Since the dawn of OpenJDK, AbstractMap.keySet and .value were defined as
>>>> package-private volatile fields. Their only use is to cache keySet and
>>>> valueSet implementations from java.util collections.
>>>
>>> I think these were declared volatile to be more clearly JMM compliant.
>>> They are definitely OK without it, but you should probably add some
>>> rationale in documentation, mentioning that all java.util.Map view class
>>> implementations using these fields have no non-final fields (or any
>>> fields at all except for outer-this).
>>
>> Good idea, did so:
>> http://cr.openjdk.java.net/~shade/8145539/webrev.04/
>>
>> (There is also an @implSpec on keySet() and values() that say no
>> synchronization is performed)
>>
>
> +1
Thanks for reviews, Claes, Peter, Doug and Paul!
With no other comments, I pushed the changeset.
Thanks,
-Aleksey
More information about the core-libs-dev
mailing list