RFR: 8328821: Map.of().entrySet() mutators should throw UnsupportedOperationException [v3]
Liam Miller-Cushon
cushon at openjdk.org
Tue Jun 4 17:42:23 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 six additional commits since the last revision:
- 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/17851d80..598af2e5
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=01-02
Stats: 20292 lines in 534 files changed: 12666 ins; 5447 del; 2179 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