RFR: 8347471: Provide valid flags and mask in AccessFlag.Location [v10]
Roger Riggs
rriggs at openjdk.org
Tue Apr 29 19:08:48 UTC 2025
On Mon, 28 Apr 2025 22:07:00 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Some AccessFlag parsing methods throw IAE because a flag mask is not valid in a location. However, there is no easy way to check what flag mask bits or what flags are valid for a location. We need such APIs to check, specific to each class file format version.
>>
>> Also in the investigation, it's noted that `ACC_SYNTHETIC` is incorrectly represented - it is available since release 5.0 instead of release 7. This bug is fixed together for implementation simplicity.
>>
>> The new methods are all in `AccessFlag.Location`:
>> - `Set<AccessFlag> flags()`
>> - `int flagsMask()`
>> - `Set<AccessFlag> flags(ClassFileFormatVersion)`
>> - `int flagsMask(ClassFileFormatVersion)`
>>
>> Also there is some simplification to `AccessFlag` itself to remove the anonymous classes, which should be more startup-friendly.
>>
>> Testing: Tier 1-3
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>
> Update specs for other existing APIs
lgtm
src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 38:
> 36: import java.lang.classfile.attribute.ModuleRequireInfo;
> 37: import java.lang.module.ModuleDescriptor;
> 38: import java.util.*;
Wildcard imports are discouraged.
-------------
Marked as reviewed by rriggs (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/23095#pullrequestreview-2804659539
PR Review Comment: https://git.openjdk.org/jdk/pull/23095#discussion_r2067147595
More information about the core-libs-dev
mailing list