On Wed, 17 Feb 2021 19:12:19 GMT, Ian Graves <igra...@openjdk.org> wrote:

>> 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.
>
> Yes -- I think in response to this it makes more sense to pull the 
> `ImmutableCollections` classes out for now and only focus on the wrapping of 
> the classes within `Collections` so we aren't blocked by studying and 
> rectifying these inconsistencies.

Maybe it is not correct for UnmodifiableEntrySet::contains to short circuit?  
What if the implementation was changed to:

`public boolean contains(Object o) {
            if (!(o instanceof Map.Entry))
                return c.contains(o); //false, NPE, or CCE
            return c.contains(
                new UnmodifiableEntry<>((Map.Entry<?,?>) o));
}`

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

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

Reply via email to