This follows JDK-8394676 (#33391), which removed the duplicated VClass test 
code from the java/util/Collections tests. It replaces #32201 and keeps value 
class coverage only where the java.util code under test behaves differently for 
value objects.

HashMap/PutNullKey.java
When colliding keys in a HashMap tree bin are not Comparable, 
HashMap.TreeNode.tieBreakOrder orders them by System.identityHashCode. For a 
value object, the identity hash code is derived from the object's field values, 
so the tree takes a different shape than with identity objects. No existing 
test reaches this path, even with identity keys: every colliding-key test uses 
Comparable keys.

Collections/Ser.java
Refactoring only, with no change in behavior or coverage. Ser already covers 
serializing Collections.singleton and nCopies with a value class element 
through a writeReplace/readResolve proxy. This change only consolidates its six 
identical serialize/deserialize/compare blocks into one helper method.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Add 8384611 to bug id
 - JDK-8384611 Improve value class test coverage in java/util Collections/Ser 
and HashMap/PutNullKey

Changes: https://git.openjdk.org/jdk/pull/33418/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33418&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8384611
  Stats: 137 lines in 3 files changed: 45 ins; 74 del; 18 mod
  Patch: https://git.openjdk.org/jdk/pull/33418.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33418/head:pull/33418

PR: https://git.openjdk.org/jdk/pull/33418

Reply via email to