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

Chen Liang liach at openjdk.org
Sat Apr 26 04:11:59 UTC 2025


On Mon, 31 Mar 2025 18:30:37 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 14 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
>  - 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
>  - Check m.entrySet().hashCode() in MOAT
>  - ... and 4 more: https://git.openjdk.org/jdk/compare/4d1de46c...d5c39132

I think our next steps are:
In early 26, if a corpus search proved no definitive incompatibility, integrate this change and post a message to quality-discuss. Same for #15614. If any incompatibility surfaces, we have sufficient time to rollback. What do you think?

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

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


More information about the core-libs-dev mailing list