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

Chris Plummer cjplummer at openjdk.org
Thu Jan 15 02:25:53 UTC 2026


On Thu, 15 Jan 2026 00:14:44 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java line 341:
>> 
>>> 339:         return ((modifiers & VMModifiers.IDENTITY) == 0)
>>> 340:             && ((modifiers & VMModifiers.INTERFACE) == 0)
>>> 341:             && ((modifiers & VMModifiers.ABSTRACT) == 0);
>> 
>> ReferenceTypeImpl has isXXX() apis to check these modifiers. We should probably use them here and add isIdentity().
>> 
>> It's unclear to me why you have to check INTERFACE and ABSTRACT. Isn't IDENTITY enough, or do interfaces and abstract classes not have the IDENTITY bit set?
>
> value class can be abstract.

So if you have a value class, the IDENTITY bit will not be set, but if the ABSTRCT bit is also set, the above logic produces false, even though it is value class and you want it to produce true.

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

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


More information about the valhalla-dev mailing list