On Tue, 2 Jun 2026 22:00:10 GMT, Bill Huang <[email protected]> wrote:
> Changed Tests:
>
> HashMap/KeySetRemove.java: equal ValueClass keys mapped to null can be
> removed from HashMap and TreeMap.
>
> HashMap/NullKeyAtResize.java: null-key resize behavior remains correct when
> surrounding keys are ValueClass instances.
>
> HashMap/PutNullKey.java: colliding comparable tree-bin keys are value-capable
> via @AsValueClass.
>
> HashMap/ReplaceExisting.java: replacing an existing ValueClass key during
> active iteration does not corrupt the iterator.
>
> HashMap/SetValue.java: Map.Entry.setValue() returns the old ValueClass value.
>
> HashMap/ToArray.java: toArray() coverage is added for ValueClass keys,
> values, and set elements across hash and linked variants.
>
> HashMap/TreeBinAssert.java: tree-bin iterator-removal coverage now uses a
> value-capable key.
>
> Hashtable/EqualsCast.java: Provider/Hashtable equality now includes matching
> ValueClass key/value entries.
>
> Hashtable/SimpleSerialization.java: serialization round-trip now also covers
> Hashtable<Integer,Integer>.
>
> LinkedHashMap/ComputeIfAbsentAccessOrder.java: access-order behavior is
> repeated with Integer keys.
>
> LinkedHashMap/EmptyMapIterator.java: fail-fast iterator behavior is repeated
> with Integer key/value entries.
>
> LinkedList/AddAll.java: append-order behavior is repeated with ValueClass
> elements.
>
> LinkedList/Clone.java: clone/equality checks for LinkedList, TreeSet, and
> TreeMap subclasses now include ValueClass contents.
>
> Unchanged Tests:
>
> HashMap/HashMapCloneLeak.java: unchanged because the test depends on
> WeakReference reachability. Value objects are not valid weak-reference
> targets, so adding VClass would not match the regression being tested.
>
> HashMap/OverrideIsEmpty.java: unchanged because the test is about HashMap
> subclass method dispatch. Value classes cannot extend HashMap, and changing
> only the key/value payload would not add meaningful value-class coverage.
>
> HashMap/WhiteBoxResizeTest.java: unchanged because it is a white-box/internal
> capacity and table-sizing test using reflection/VarHandles over HashMap,
> LinkedHashMap, HashSet, and WeakHashMap internals. Its purpose is sizing/lazy
> allocation/resize arithmetic, not key/value equality or value-object behavior.
>
> HashMap/ToString.java: unchanged because it specifically verifies that
> HashMap.Entry.toString() does not throw when the map contains null keys or
> values. Adding value-class keys or values would not extend the original
> null-handling regression in a meaningful way.
>
> HashSet/Serialization.java: unchanged because the existing HashSet<I...
Changes requested by lmesnik (Committer).
test/jdk/java/util/HashMap/KeySetRemove.java line 47:
> 45:
> 46: Map[] valueMaps = {new HashMap<>(), new TreeMap<>()};
> 47: for (int i=0; i<valueMaps.length; i++) {
please update indentation (spaces)
test/jdk/java/util/HashMap/PutNullKey.java line 50:
> 48: static final float LOAD_FACTOR = 1.0f;
> 49:
> 50: @AsValueClass
Can you please add the second testcase and new class
CollidingHashValue
that is ' @AsValueClass'
You fix is going to work perfectly now, but later the plan is to rewrite
@AsValueClass with 'value class' and don't run the test with and without
preview. So 2 testcases would be reuiqred.
test/jdk/java/util/HashMap/SetValue.java line 55:
> 53: }
> 54:
> 55: private static void testTupleValue() {
Not sure if tuple is good name here, might be testVClassValue?
test/jdk/java/util/HashMap/ToArray.java line 50:
> 48: checkSet(false);
> 49: checkSet(true);
> 50: checkTupleMap(false);
Same about tuple in name.
"Not sure if tuple is good name here, might be testVClassValue?"
test/jdk/java/util/HashMap/TreeBinAssert.java line 159:
> 157: * Class that will have specified hash code in a HashMap.
> 158: */
> 159: @AsValueClass
The same comment about having 2 testcases.
-------------
PR Review:
https://git.openjdk.org/valhalla/pull/2501#pullrequestreview-4414522586
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2501#discussion_r3345150184
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2501#discussion_r3345159016
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2501#discussion_r3345163516
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2501#discussion_r3345265923
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2501#discussion_r3345268393