RFR: 8297271: AccessFlag.maskToAccessFlags should be specific to class file version [v4]

Chen Liang liach at openjdk.org
Tue Apr 29 20:03:51 UTC 2025


On Tue, 29 Apr 2025 19:41:23 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits:
>> 
>>  - Wording updates
>>  - Merge branch 'feature/af-location-accessors' into feature/af-cffv-parse
>>  - Missing since
>>  - Fix javap causing strictfp tests to fail
>>  - Further furnish docs
>>  - Merge branch 'feature/af-location-accessors' into feature/af-cffv-parse
>>  - Merge branch 'feature/af-location-accessors' into feature/af-cffv-parse
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into feature/af-cffv-parse
>>  - Redundant method
>>  - 8297271: AccessFlag.maskToAccessFlags should be specific to class file version
>
> src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 401:
> 
>> 399:     public static Set<AccessFlag> maskToAccessFlags(int mask, Location location, ClassFileFormatVersion cffv) {
>> 400:         var definition = findDefinition(location);
>> 401:         int unmatchedMask = mask & (~location.flagsMask(cffv)); // implicit null check
> 
> Implicit null check is actually in `findDefinition`.
> There's little harm is looking up the definition before checking for unmatched mask bits but it could be delayed and inlined as the argument to `new AccessFlagSet`.

Oops, this was the implicit null check for cffv. Should I make all of the checks explicit?

Also, I split out `findDefinition` as in value objects, it will become `findDefinition(location, cffv)`, when the valhalla cffv is passed, findDefinition can return differently for Location.CLASS.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24760#discussion_r2067292304


More information about the core-libs-dev mailing list