RFR: 8339260: Move rarely used constants out of ClassFile [v7]

Chen Liang liach at openjdk.org
Mon Sep 23 21:52:37 UTC 2024


On Mon, 23 Sep 2024 21:42:11 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
> 
>  - Move raw opcodes to impl only
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>    
>    # Conflicts:
>    #	src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java
>    #	src/java.base/share/classes/jdk/internal/classfile/impl/SplitConstantPool.java
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>  - omission in tests
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>  - Rename constants at new locations, link to related factories, cp tag constant names
>  - Fix compile errors
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>  - ... and 6 more: https://git.openjdk.org/jdk/compare/e97f0fe1...8b03ad17

@asotona Updated and removed the opcode raw values; they are exposed just through `Opcode::bytecode` and the raw values are moved to `RawBytecodeHelper`. If users demand these raw values, we can add back later.

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

PR Comment: https://git.openjdk.org/jdk/pull/20773#issuecomment-2369553635


More information about the core-libs-dev mailing list