RFR: 8285295: Need better testing for IdentityHashMap [v4]

ExE Boss duke at openjdk.java.net
Thu May 5 13:59:31 UTC 2022


On Wed, 4 May 2022 19:16:14 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> Basic but fairly comprehensive set of tests for `IdentityHashMap`. The patch in the bug report that breaks `IdentityHashMap` now causes several cases in this new test to fail. There's more that could be done, but the new tests cover most of the core functions of `IdentityHashMap`. Unfortunately it seems difficult to merge this with the existing, comprehensive Collections tests (e.g., MOAT.java) because those tests implicity rely on `equals()`-based contract instead of the special-purpose `==`-based contract used by `IdentityHashMap`.
>
> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add some assertions for entrySet.equals and keySet.equals

As I said in [GH‑6532]:
> There should probably be something like [test/jdk/java/util/Collections/Wrappers.java] to check that `IdentityHashMap` overrides all `default` methods from `java.util.Map` (with `remove(K, V)` and `replace(K, V, V)` depending on [GH‑8259]).

[GH‑6532]: https://github.com/openjdk/jdk/pull/6532#issuecomment-1104709021
[GH‑8259]: https://github.com/openjdk/jdk/pull/8259
[test/jdk/java/util/Collections/Wrappers.java]: https://github.com/openjdk/jdk/blob/master/test/jdk/java/util/Collections/Wrappers.java

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

PR: https://git.openjdk.java.net/jdk/pull/8354


More information about the core-libs-dev mailing list