RFR: JDK-8266670: Better modeling of access flags in core reflection [v17]
Joe Darcy
darcy at openjdk.java.net
Mon Jun 13 23:36:55 UTC 2022
On Wed, 13 Apr 2022 21:21:25 GMT, liach <duke at openjdk.java.net> wrote:
>> src/java.base/share/classes/java/lang/module/ModuleDescriptor.java line 167:
>>
>>> 165: * but is optional in the dynamic phase, during execution.
>>> 166: */
>>> 167: STATIC(AccessFlag.STATIC.mask()),
>>
>> This is actually `AccessFlag.STATIC_PHASE` (`0x0040`), and not `AccessFlag.STATIC` (`0x0008`):
>> Suggestion:
>>
>> STATIC(AccessFlag.STATIC_PHASE.mask()),
>
>> In the current hodgepodge AccessFlag, we have STATIC and STATIC_PHASE, and the incorrect ModuleDescriptor.accessFlags().contains(AccessFlag.STATIC) call is much more subtle, especially to new users of this class. Arguably, this misuse would be way worse than that in the distinct enum case.
>
> Oops, didn't know this already happened. Good spot right there.
Corrected to STATIC_PHASE in subsequent push; thanks.
-------------
PR: https://git.openjdk.org/jdk/pull/7445
More information about the core-libs-dev
mailing list