RFR: JDK-8266670: Better modeling of access flags in core reflection [v17]

Joe Darcy darcy at openjdk.java.net
Mon Mar 7 21:37:08 UTC 2022


On Mon, 7 Mar 2022 18:20:23 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 26 additional commits since the last revision:
>> 
>>  - Respond to review feedback.
>>  - Merge branch 'master' into JDK-8266670
>>  - Make workding changes suggested in review feedback.
>>  - Merge branch 'master' into JDK-8266670
>>  - Typo fix; add implSpec to Executable.
>>  - Appease jcheck.
>>  - Fix some bugs found by inspection, docs cleanup.
>>  - Merge branch 'master' into JDK-8266670
>>  - Initial support for accessFlags methods
>>  - Add mask to access flag functionality.
>>  - ... and 16 more: https://git.openjdk.java.net/jdk/compare/36b93dbf...14980605
>
> src/java.base/share/classes/java/lang/Class.java line 1334:
> 
>> 1332:         // allows PRIVATE, PROTECTED, and STATIC, which are not
>> 1333:         // allowed on Location.CLASS.
>> 1334:         return AccessFlag.maskToAccessFlags(getModifiers(),
> 
> Computing and creating the Set every time seems like a high overhead operation (compared to getModifiers()).
> Caching either here (in the Member) or in AccessFlag.maskToAccessFlags would be desirable.
> Caching is idempotent so it should not need synchronization.

For this phase of the work, I was trying to avoid premature optimization of building caches, etc. Such refinement should certainly be considered later on.

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

PR: https://git.openjdk.java.net/jdk/pull/7445


More information about the core-libs-dev mailing list