[lworld] RFR: 8357373: [lworld] jdk/valhalla/valuetypes/ObjectMethods.java fails with -XX:+UseAtomicValueFlattening
Chen Liang
liach at openjdk.org
Thu Dec 4 22:32:33 UTC 2025
On Thu, 4 Dec 2025 22:02:35 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> This test failing with VM options prompted a refatoring and cleanup of the test (and renaming to be more appropriate).
> The test is re-enabled with a 4 combinations of command line flags.
>
> Refactored test to verify that hashcode changed with each change to a field. Previously, the test tried to compute the hashCode for the value class. That was fragile in the presence of the VM changing the layout information. Check the hashCodes are equal for objects that are `.equals`. Renamed to 'ValueObjectMethodsTest`.
test/jdk/valhalla/valuetypes/ValueObjectMethodsTest.java line 282:
> 280: assertTrue(objects.size() > 1, "More than one object is required: " + objects);
> 281:
> 282: long count = objects.stream().map(Object::hashCode).distinct().count();
Suggestion:
long count = objects.stream().map(System::identityHashCode).distinct().count();
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1771#discussion_r2590805399
More information about the valhalla-dev
mailing list