RFR: 8295059: test/langtools/tools/javap 12 test classes use com.sun.tools.classfile library

Adam Sotona asotona at openjdk.org
Thu Jul 27 01:41:04 UTC 2023


On Wed, 12 Jul 2023 15:22:33 GMT, Qing Xiao <duke at openjdk.org> wrote:

>> test/langtools/tools/javap/TestClassNameWarning.java line 182:
>> 
>>> 180:         Classfile.of().buildTo(
>>> 181:                 classes.resolve("Z.class"),
>>> 182:                 ClassDesc.of("0"), cb -> {
>> 
>> Zero constant pool index means there is physically no entry (a kind of null value).
>> According to the spec the class name CP entry is mandatory, so Classfile API does not allow to enter no value and create a class file with 0 index of the class name.
>> We will have to figure out the way how to write 0 CP index for class name or skip this part of the test.
>> ClassDesc.of("0") is valid class name, so testing of the 0 CP index is skipped here.
>
> Hi Adam. Another file of Javac package: test/langtools/tools/javac/classreader/BadClass.java also changed the CP index with sun.tools.classfile API. Can you take a look at it?
> Until we figured out the way of changing CP index, should I rollback my changes and leave these two tests open?

Classfile API doesn't allow to create an invalid entry.
I'll investigate if it is worth to extend the API, implement some low-lever workaround or skip this specific test case and leave it with valid class name.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14837#discussion_r1261414225


More information about the compiler-dev mailing list