[lworld] RFR: 8376512: [lworld] Value objects should consistently use System.identityHashCode

Chen Liang liach at openjdk.org
Tue Jan 27 23:15:22 UTC 2026


On Tue, 27 Jan 2026 22:21:08 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> For value objects, the ValueObjectMethods.valueObjectHashCodeAlt uses System.identityHashCode for all referenced objects.

Good!

src/java.base/share/classes/java/lang/runtime/ValueObjectMethods.java line 1467:

> 1465:      */
> 1466:     private static int valueObjectHashCodeAlt(Object obj) {
> 1467:         if (VERBOSE && obj != null) {

Don't think we need this null check, we would crash right below. Without this check it is still a crash, no debug info is lost.

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

Marked as reviewed by liach (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/1987#pullrequestreview-3713894079
PR Review Comment: https://git.openjdk.org/valhalla/pull/1987#discussion_r2734205982


More information about the valhalla-dev mailing list