On Wed, 27 Mar 2024 21:49:10 GMT, Chen Liang <li...@openjdk.org> wrote:

>> This change overrides mutator methods in the implementation returned by 
>> `Map.of().entrySet()` to throw `UnsupportedOperationException`.
>
> src/java.base/share/classes/java/util/ImmutableCollections.java line 1321:
> 
>> 1319:                 }
>> 1320: 
>> 1321:                 // all mutating methods throw 
>> UnsupportedOperationException
> 
> Can we change this anonymous class to `return new AbstractImmutableSet<>` and 
> override `hashCode` with `MapN.this.hashCode()`?

Thanks, I tried that out and it looks good based on the test coverage. I have 
tentatively updated the PR to use that approach.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18522#discussion_r1542163440

Reply via email to