On Fri, 19 Feb 2021 01:52:51 GMT, liach <github.com+7806504+li...@openjdk.org> 
wrote:

>> 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));
>> }`
>
> This however changes the behavior of unmodifiable maps compared to before; 
> i.e. before for other entry sets, they could not throw exception if the 
> object passed was not map entry; now they can.

Yes, it seems reasonable to decouple the `ImmutableCollections` issues from 
this change.

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

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

Reply via email to