[lworld] RFR: 8294678: [lworld] Update AccessFlags tests to include ACC_IDENTITY and ACC_VALUE [v3]
Roger Riggs
rriggs at openjdk.org
Wed Oct 5 17:44:34 UTC 2022
On Tue, 4 Oct 2022 20:50:46 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> 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.)
I'd like to commit this PR as is on this point and propose a separate PR to add ACC_IDENTITY and ACC_VALUE to the modifiers for arrays to be able to judge the impact and get further review.
https://bugs.openjdk.org/browse/JDK-8294866
-------------
PR: https://git.openjdk.org/valhalla/pull/775
More information about the valhalla-dev
mailing list