RFR: 8030016: HashMap.computeIfAbsent generates spurious access event
Paul Sandoz
paul.sandoz at oracle.com
Fri Dec 13 08:49:05 UTC 2013
On Dec 12, 2013, at 6:24 AM, Mike Duigou <mike.duigou at oracle.com> wrote:
> Hello all;
>
> In the review for JDK-8029795 Paul Sandoz noted that HashMap.computeIfAbsent would generate a spurious access event for keys mapped to null when the function returned null. This patch corrects that behaviour.
>
> http://cr.openjdk.java.net/~mduigou/JDK-8030016/0/webrev/
>
> The actual regression test is LinkedHashMap/ComputeIfAbsentAccessOrder.java whereas the changes to Map/Defaults are improvements to the existing tests suggested by this bug (though they would not detect it).
>
Looks OK to me.
I believe that fits better within the strange world of an existing entry considered absent if its value is null i.e. no side-effects if the entry is absent and mapping function returns null.
Paul.
More information about the core-libs-dev
mailing list