[lworld] RFR: 8294678: [lworld] Update AccessFlags tests to include ACC_IDENTITY and ACC_VALUE [v2]
Roger Riggs
rriggs at openjdk.org
Tue Oct 4 20:54:36 UTC 2022
On Tue, 4 Oct 2022 20:03:59 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update ObjectMethods test
>
> 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()`.
My goal was to have the Class.accessFlags() be consistent with Class methods `isIdentity()` and `isValue()`.
Unless we prevail in adding ACC_IDENTITY and ACC_VALUE to Class.getModifiers() there will be an inconsistency among the APIs. `getModifiers()`, though the oldest, has the least flexibility. The goal of the AccessFlags API was to be more flexible, correct, and extensible. It is a question of what the end state should be and how to get there.
(The check for isArray() to select the INNER_CLASS location was from the original AccessFlag PR.)
-------------
PR: https://git.openjdk.org/valhalla/pull/775
More information about the valhalla-dev
mailing list