RFR: 8328821: Map.of() derived view collection mutators should throw UnsupportedOperationException [v11]

Chen Liang liach at openjdk.org
Fri May 30 01:33:59 UTC 2025


On Wed, 28 May 2025 17:13:41 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> This change overrides mutator methods in the implementation returned by `Map.of().entrySet()` to throw `UnsupportedOperationException`.
>
> Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
> 
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - Update test/jdk/java/util/Collection/MOAT.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>
>  - Update copyright year
>    
>    and add the bug number to the modified test
>  - Update unmodifiable map javadoc
>  - Also throw UOE for mutators on keySet() and values()
>    
>    and add more test coverage to MOAT.
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
>  - ... and 5 more: https://git.openjdk.org/jdk/compare/b2a61a99...785f728d

For some reason the lines you've added for UOE in MOAT are failing; can you check?

I have reviewed the CSR for you. Maybe us, Per Minborg, and Stuart Marks can work together to get the two significant collection changes into early 26 and broadcast on quality discuss list, as otherwise corpus analysis provides little useful information on the compatibility impact.

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

PR Comment: https://git.openjdk.org/jdk/pull/18522#issuecomment-2920978415


More information about the core-libs-dev mailing list