[lworld] RFR: 8373202: [lworld] ObjectReference.equals should follow == semantics for value objects

Chris Plummer cjplummer at openjdk.org
Wed Jan 14 18:24:46 UTC 2026


On Thu, 18 Dec 2025 20:00:45 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> Updated implementation of ObjectReference.equals and ObjectReference.hashCode to comply the spec for value objects.
> Added the test for value object ctor debugging, the test verifies the behaviour is expected.
> There is an issue with instance filter, it till be fixed separately (it's not yet clear how it would be better to fix it)
> 
> testing: tier1..4, hs-tier5-svc

src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java line 150:

> 148:     public boolean equals(Object obj) {
> 149:         if (obj instanceof ObjectReferenceImpl other) {
> 150:             if (!super.equals(obj)) { // checks if the references belong to the same VM

Have you considered adding a `this == obj` check at the beginning of this method. I think usually we are dealing with the same heap object, so this could be a quick check done for performance reasons.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1834#discussion_r2691548928


More information about the valhalla-dev mailing list