On Wed, 17 Feb 2021 14:37:52 GMT, liach <github.com+7806504+li...@openjdk.org> 
wrote:

>> This sounds like an inconsistency between `Map1` and `MapN` that should 
>> perhaps be considered a bug that needs fixing. /ping @stuart-marks
>
> 2 remarks:
> 1. MapN's entry set extends abstract set, whose `contains` is null-friendly 
> like 
> https://github.com/openjdk/jdk/blob/cb84539d56209a6687c4ec71a61fdbe6f06a46ea/src/java.base/share/classes/java/util/AbstractCollection.java#L104
> 2. The problem of unmodifiable map's entry set not always delegating 
> everything to the backing entry set still exists. 
> https://github.com/openjdk/jdk/blob/cb84539d56209a6687c4ec71a61fdbe6f06a46ea/src/java.base/share/classes/java/util/Collections.java#L1724
>  This will bypass the underlying logic when the argument is `null` or not an 
> entry.
> 
> The behavior pointed out by michaelhixson is the conglomeration of these 2 
> unspecified behaviors.

This raises some interesting issues and makes me wonder if we should allow a 
single-wrap of the `ImmutableCollections` classes for now to make this less 
onerous.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2596

Reply via email to