On Thu, 28 Aug 2025 13:32:26 GMT, Roger Riggs <[email protected]> wrote:
>> src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java line >> 682: >> >>> 680: K ek; >>> 681: if (e.hash == h && >>> 682: (ek = e.key) != null && Objects.equals(k, ek)) >> >> Looking at the code in HashMap, I think you can just use `Objects.equals(k, >> ek = e.key)`, or just `k.equals(ek = e.key)` because `Object::equals` is >> supposed to return false on null. > > HashMap allows null keys and that is handled separately in each case, not by > the `equals` method. > "supposed to" is not sufficient when compatibility is concerned. I think your current logic differs when `e.key == null` and `k == null` - previously it evaluates to true, now this test fails. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/1536#discussion_r2307452667
