[lworld] RFR: 8294678: [lworld] Update AccessFlags tests to include ACC_IDENTITY and ACC_VALUE

Mandy Chung mchung at openjdk.org
Tue Oct 4 20:07:46 UTC 2022


On Tue, 4 Oct 2022 19:16:50 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> The tests for Class.accessFlags should be updated to check ACC_IDENTITY and ACC_VALUE. 
> Update ClassAccessFlagTest and ObjectMethods test to check consistency between
> Class.isIdentity() and Class.isValue() methods with the Class accessFlags().

src/java.base/share/classes/java/lang/Class.java line 1522:

> 1520:         final int mask = ((location == AccessFlag.Location.CLASS) ?
> 1521:                 getClassAccessFlagsRaw() : getModifiers()) |
> 1522:                 (isArray() ? Modifier.IDENTITY : 0);

For an array class `a`, `a.accessFlags()` and `AccessFlag.maskToAccessFlags(a.getModifiers(), Location.CLASS)` won't return the same `AccessFlag` set then.   The access flags for array type is special anyway.    It would be less confusing if `Class::accessFlags()` is consistent with `Class::getModifiers()`.

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

PR: https://git.openjdk.org/valhalla/pull/775



More information about the valhalla-dev mailing list