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

Joe Darcy darcy at openjdk.org
Fri Jun 17 01:42:30 UTC 2022


> This is an early review of changes to better model JVM access flags, that is "modifiers" like public, protected, etc. but explicitly at a VM level.
> 
> Language level modifiers and JVM level access flags are closely related, but distinct. There are concepts that overlap in the two domains (public, private, etc.), others that only have a language-level modifier (sealed), and still others that only have an access flag (synthetic).
> 
> The existing java.lang.reflect.Modifier class is inadequate to model these subtleties. For example, the bit positions used by access flags on different kinds of elements overlap (such as "volatile" for fields and "bridge" for methods. Just having a raw integer does not provide sufficient context to decode the corresponding language-level string. Methods like Modifier.methodModifiers() were introduced to cope with this situation.
> 
> With additional modifiers and flags on the horizon with projects like Valhalla, addressing the existent modeling deficiency now ahead of time is reasonable before further strain is introduced.
> 
> This PR in its current form is meant to give the overall shape of the API. It is missing implementations to map from, say, method modifiers to access flags, taking into account overlaps in bit positions.
> 
> The CSR https://bugs.openjdk.java.net/browse/JDK-8281660 will be filled in once the API is further along.

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 44 additional commits since the last revision:

 - Fix typo Exe-Boss spotted in review feedback.
 - Merge branch 'master' into JDK-8266670
 - Appease jcheck.
 - Expand regression tests.
 - Merge branch 'master' into JDK-8266670
 - Respond to review feedback from Roger Riggs.
 - Respond to review feedback.
 - Make mask fields final in ModuleDescriptor.
 - Correct STATIC vs STATIC_PHASE issue found in code review.
 - From review feedback, use package-private contstants in Modifier.
 - ... and 34 more: https://git.openjdk.org/jdk/compare/d64a6d2b...81e6ef07

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/7445/files
  - new: https://git.openjdk.org/jdk/pull/7445/files/ebb01e1d..81e6ef07

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=7445&range=28
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=7445&range=27-28

  Stats: 2200 lines in 70 files changed: 1652 ins; 213 del; 335 mod
  Patch: https://git.openjdk.org/jdk/pull/7445.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/7445/head:pull/7445

PR: https://git.openjdk.org/jdk/pull/7445


More information about the core-libs-dev mailing list