[lworld] RFR: 8373202: [lworld] ObjectReference.equals should follow == semantics for value objects
Alex Menkov
amenkov at openjdk.org
Mon Jan 12 21:55:51 UTC 2026
On Fri, 19 Dec 2025 04:34:18 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> agreed. Do I understand correctly that I cannot modify existing command (jdwp protocol shoul be backward compatible?) to get classes and need a new one to check if the class is value class?
>
> I'm not sure what your backward compatible question is. I think we need an API to determine if a ClassType is a value type or not. This could be expensive to maintain. Probably we need to only look it up when needed and can keep it cached with the ClassType. Another option is to only try to avoid the IsSameObject callback when we are not dealing with an ObjectReferenceImpl subclass. We can make a check something like `obj.getClass() == ObjectReferenceImpl.class`. When they are not equal, then we are dealing with a subclass that we know can't be a value type.
I added a check if the object is value object (implemented as a new JDWP command first, but then simplified to test modifiers - the same approach as in hotspot)
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1834#discussion_r2683890387
More information about the valhalla-dev
mailing list