On Sat, 26 Apr 2025 19:44:02 GMT, Chen Liang <li...@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: > > Fix iterator missing NSEE src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 722: > 720: } > 721: > 722: private static final class AccessFlagSet extends > AbstractSet<AccessFlag> { This should probably also define the spliterator method: @Override public Spliterator<AccessFlag> spliterator() { return Spliterators.spliterator( this, Spliterator.DISTINCT | Spliterator.ORDERED | Spliterator.SIZED | Spliterator.NONNULL | Spliterator.IMMUTABLE | Spliterator.SUBSIZED ); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23095#discussion_r2062674913