[lworld] RFR: 8294312: [lworld] Add java.util.Objects.isIdentityObject [v2]
Mandy Chung
mchung at openjdk.org
Thu Sep 29 21:25:48 UTC 2022
On Thu, 29 Sep 2022 19:44:16 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.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>
> Review comment updates related to ValhallaFeatures.isEnabled().
> And javadoc cleanup
Looks okay in general. A couple minor comments.
src/java.base/share/classes/java/lang/Class.java line 645:
> 643: * @since Valhalla
> 644: */
> 645: public boolean isIdentity() {
The javadoc for `isIdentity` should specify if this Class is an array class, primitive type or `void`.
src/java.base/share/classes/java/lang/Class.java line 657:
> 655: */
> 656: public boolean isValue() {
> 657: return ValhallaFeatures.isEnabled() && // Before Valhalla no classes are value classes
`isValue` does not need to check `-XX:+EnableVahalla` since the new `VALUE` flag can only be set in a value class and if the feature is enabled.
src/java.base/share/classes/java/lang/Object.java line 39:
> 37: * including arrays, implement the methods of this class.
> 38: * <p>
> 39: * Subclasses of {@code java.lang.Object} can be either identity classes or value classes.
suggest to add a link to `Class::isIdentity` and `Class::isValue`
src/java.base/share/classes/java/util/Objects.java line 194:
> 192:
> 193: /**
> 194: * {@return {@code true} if the object is an identity object, otherwise {@code false}}
nit: s/the object/the specified object/
-------------
PR: https://git.openjdk.org/valhalla/pull/770
More information about the valhalla-dev
mailing list