RFR: 8328821: Map.of().entrySet() mutators should throw UnsupportedOperationException [v4]
Liam Miller-Cushon
cushon at openjdk.org
Tue Jul 9 19:23:54 UTC 2024
> 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 incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
- 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
- Merge remote-tracking branch 'origin/master' into JDK-8328821-make-clear-consistent
- Use AbstractImmutableSet
- Throw UOE for all Map.of().entrySet() mutator methods
- 8328821: Make the ImmutableCollections clear() call consistent
Without overriding clear(), a call to it in an empty map would
just return, as iterator.hasNext() would be false. However if
calling Map.of().clear() throws an exception. To make the
behavior of Map.of().entrySet().clear() consistent, we need to
have an implementation of clear() for the entry set that throws
as well.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/18522/files
- new: https://git.openjdk.org/jdk/pull/18522/files/598af2e5..4c9a511f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=02-03
Stats: 30615 lines in 772 files changed: 17927 ins; 10197 del; 2491 mod
Patch: https://git.openjdk.org/jdk/pull/18522.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18522/head:pull/18522
PR: https://git.openjdk.org/jdk/pull/18522
More information about the core-libs-dev
mailing list