On Thu, 21 Apr 2022 01:01:25 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare >> values by identity. Updated API documentation of these two methods >> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityHashMap.html#remove(java.lang.Object,java.lang.Object))) >> to mention such behavior. > > src/java.base/share/classes/java/util/IdentityHashMap.java line 1412: > >> 1410: i = nextKeyIndex(i, len); >> 1411: } >> 1412: } > > Unfortunately there's some mostly-duplicate code here. However, there's > similar logic and code sprinkled throughout this class, so _more_ duplication > isn't necessarily the wrong thing to do. However, trying to unify this logic > results in much more intrusive refactoring, which is harder to review, and > which isn't backed up with tests (see JDK-8285295) which I wouldn't encourage > pursuing right now. In other words, I'm ok with this duplicate logic. On intrusive logic: I planned address it in https://bugs.openjdk.java.net/browse/JDK-8277520 (#6532), and if this one is integrated first, it may be possible to fix it up there. ------------- PR: https://git.openjdk.java.net/jdk/pull/8259