RFR: 8328821: Map.of().entrySet() mutators should throw UnsupportedOperationException [v2]
Liam Miller-Cushon
cushon at openjdk.org
Mon May 27 18:27:20 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 five additional commits since the last revision:
- 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/42d67d16..17851d80
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18522&range=00-01
Stats: 211051 lines in 4323 files changed: 117813 ins; 68929 del; 24309 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