On Sun, 16 Mar 2025 19:06:36 GMT, Luca Kellermann <d...@openjdk.org> wrote:
>> Per Minborg has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 246 commits: >> >> - Merge branch 'master' into implement-jep502 >> - Clean up exception messages and fix comments >> - Rename field >> - Rename method and fix comment >> - Rework reenterant logic >> - Use acquire semantics for reading rather than volatile semantics >> - Add missing null check >> - Simplify handling of sentinel, wrap, and unwrap >> - Fix JavaDoc issues >> - Fix members in StableEnumFunction >> - ... and 236 more: https://git.openjdk.org/jdk/compare/4e51a8c9...d6e1573f > > src/java.base/share/classes/java/util/ImmutableCollections.java line 1488: > >> 1486: final K k = (K) key; >> 1487: return stable.orElseSet(new Supplier<V>() { >> 1488: @Override public V get() { return mapper.apply(k); }}); > > This can return `null` (`StableMap` does allow `null` values), so the > `getOrDefault` implementation in `AbstractImmutableMap` does not properly > work for `StableMap`: > > var map = StableValue.map(Set.of(1), _ -> null); > // should print "null", but prints "default value" > System.out.println(map.getOrDefault(1, "default value")); Thanks for identifying this issue. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2020689451