RFR: 8024688: j.u.Map.merge doesn't work as specified if contains key:null pair
David Holmes
david.holmes at oracle.com
Fri Oct 4 05:15:56 UTC 2013
On 4/10/2013 1:35 PM, Mike Duigou wrote:
> Hello all;
>
> This is a changeset which improves the consistency of several Map.merge implementations for handling of null values.
It isn't at all clear to me what specification you are using to define
the expected behaviour here. I would have thought that anyone supplying
a remapping function needs to be aware of whether the target map
supports nulls or not, and that the remapping function should then do
the right thing if null is encountered. Instead you are making the
decision to bypass the remapping function if you encounter a null.
David
> The existing unit tests hadn't considered several cases where the result of the remapper was not the same as the value. I've restructured the merge tests to be more thorough and systematic this revealed a couple of problems.
>
> http://cr.openjdk.java.net/~mduigou/JDK-8024688/0/webrev/
>
> Like several of the previous patches, this one introduces an alternative default for ConcurrentMap to work around issues involving null values where the handling in the general Map default would be incorrect.
>
> Mike
>
More information about the core-libs-dev
mailing list