On Thu, 28 Apr 2022 13:22:34 GMT, Jaikiran Pai <j...@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`.
>
> test/jdk/java/util/IdentityHashMap/Basic.java line 337:
> 
>> 335:     public void testPutOverwrite() {
>> 336:         Box newVal = new Box(v1a);
>> 337:         map.put(k1a, newVal);
> 
> Should we capture the return value and assert that it's not null and is 
> identity equal to `v1a`?
> 
> Perhaps, similarly at a few other places where we do put and putIfAbsent?

Yes, good point, I'll add checks of the return values in the appropriate 
places. There are several, including `remove`, `computeX`, `put`, etc.

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

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

Reply via email to