RFR: 8339260: Move rarely used constants out of ClassFile

Chen Liang liach at openjdk.org
Thu Aug 29 21:32:29 UTC 2024


Many constants are cluttered in `ClassFile`. However, only a few of them are ever used by regular users, most notably `ACC_` flags and `JAVA_X_VERSION` constants. All other constants are specific and should live in more local locations, such as getters that return these constants.

This simplification of `ClassFile` constants improves user onramp to the Class-File API.

Notably, before, if `ClassFile` is static imported, `Opcode` enums must be qualified due to name clashes; this relocation allows `Opcode` enums to be static imported with `ACC_` flags, improving class file writing user experience.

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

Commit messages:
 - Compile errors; now tests are all green.
 - Move Constant Pool tags to PoolEntry
 - opcode values moved to OpcodeValues
 - Hide default class flags as well
 - Simplify SimpleVerificationTypeInfo's constant names
 - 8339260: Move rarely used constants out of ClassFile

Changes: https://git.openjdk.org/jdk/pull/20773/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20773&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339260
  Stats: 2613 lines in 36 files changed: 865 ins; 905 del; 843 mod
  Patch: https://git.openjdk.org/jdk/pull/20773.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20773/head:pull/20773

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


More information about the core-libs-dev mailing list