On Fri, 16 Oct 2026 17:30:52 GMT, Bill Huang <[email protected]> wrote:

> 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).

Test changes look good. The Collections/Ser.java cleanup in particular is a 
considerable improvement on what was there before, which had a lot of 
duplicatation. It's possible to do a bit more with it (e.g., use `var`, use 
try-with-resources) but it's not clear to me that it's worth tinkering with it 
further.

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

Marked as reviewed by smarks (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33418#pullrequestreview-5594460366

Reply via email to