RFR: 8339260: Move rarely used constants out of ClassFile [v9]
Luca Kellermann
duke at openjdk.org
Wed Oct 2 20:02:41 UTC 2024
On Tue, 24 Sep 2024 17:23:41 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 incrementally with one additional commit since the last revision:
>
> AbstractPoolEntry is broken too
src/java.base/share/classes/java/lang/classfile/AnnotationValue.java line 482:
> 480: * describe the possible return values of this method.
> 481: */
> 482: char tag();
Why is the type of the constants different from the return type of this function?
src/java.base/share/classes/java/lang/classfile/constantpool/PoolEntry.java line 104:
> 102: * describe the possible return values of this method.
> 103: */
> 104: byte tag();
The same question applies here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20773#discussion_r1785109411
PR Review Comment: https://git.openjdk.org/jdk/pull/20773#discussion_r1785114283
More information about the core-libs-dev
mailing list