[lworld] RFR: 8294312: [lworld] Add java.util.Objects.isIdentityObject
Mandy Chung
mchung at openjdk.org
Thu Sep 29 18:14:12 UTC 2022
On Wed, 28 Sep 2022 15:49:05 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Add `java.util.Objects.isIdentityObject(obj)` and update tests.
>
> Correct j.l.Class.isIdentity() and .isValue() to correctly identify all arrays as identity objects.
> (The modifiers for array classes do have not reliable ACC_IDENTITY or ACC_VALUE bits).
>
> Updated ValhallaFeaturesTest to use junit.
src/java.base/share/classes/java/util/Objects.java line 201:
> 199: return o.getClass().isIdentity() ||
> 200: o.getClass() == Object.class ||
> 201: !ValhallaFeatures.isEnabled(); // Before Valhalla all objects are identity objects.
`Class::isIdentity` should check for `!ValhallaFeatures.isEnabled()` as well. Just a side note: we will need to go through the current implementation to see where this check is needed as well.
test/jdk/valhalla/valuetypes/ObjectMethods.java line 85:
> 83: {new PrimitiveRecord(1, "A"), false},
> 84: {new ValueRecord(1,"B"), false},
> 85: {new int[0], true}, // arrays of primitives classes are identity objects
s/primitives/primitive/
-------------
PR: https://git.openjdk.org/valhalla/pull/770
More information about the valhalla-dev
mailing list