On 12/16/2015 05:53 PM, Aleksey Shipilev wrote:
Hi,
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).
-Doug