A DESCRIPTION OF THE PROBLEM :
There's a problem in some module-info.sig files in ct.sym of recent JDK distributions, where the `ModuleMainClass` attribute references a Utf8 constant pool entry instead of a Class entry.
For example, the file `L/jdk.httpserver/module-info.sig` ("L" corresponds to version 21) located in ct.sym of JDK 22 references a Utf8 entry with the value `sun/net/httpserver/simpleserver/Main` instead of a corresponding Class entry.
Apparently, compiling anything with javac 22 with `--release 21` and dependency on jdk.httpserver works fine, but this breaks other tools which try to parse this file as a class file. Javap reports the following error:
Error: Not a ClassEntry at index: 6
JDK's classfile library fails with:
Exception in thread "main" java.lang.classfile.constantpool.ConstantPoolException: Not a ClassEntry at index: 6
at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:392)
at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readClassEntry(ClassReaderImpl.java:431)
at java.base/jdk.internal.classfile.impl.BoundAttribute$BoundModuleMainClassAttribute.mainClass(BoundAttribute.java:455)
And ASM fails with:
java.lang.ArrayIndexOutOfBoundsException: Index 36 out of bounds for length 18
at org.objectweb.asm.ClassReader.readUtf(ClassReader.java:3649)
at org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:3636)
at org.objectweb.asm.ClassReader.readStringish(ClassReader.java:3706)
at org.objectweb.asm.ClassReader.readClass(ClassReader.java:3721)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:515)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:395)
... which was originally discovered by a report to the Kotlin issue tracker at https://youtrack.jetbrains.com/issue/KT-67668.
Same problem happens with the version of this file in JDK 21 for releases 18..20 (`IJK/jdk.httpserver/module-info.sig`).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Unpack the JDK 22's `lib/ct.sym` zip archive
2) Rename the extracted file `L/jdk.httpserver/module-info.sig` to `module-info.class`
3) Run javap on this class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
javap should print the whole module definition without errors.
ACTUAL -
javap displays an error about the incorrect value of the `ModuleMainClass` attribute.
FREQUENCY : always
There's a problem in some module-info.sig files in ct.sym of recent JDK distributions, where the `ModuleMainClass` attribute references a Utf8 constant pool entry instead of a Class entry.
For example, the file `L/jdk.httpserver/module-info.sig` ("L" corresponds to version 21) located in ct.sym of JDK 22 references a Utf8 entry with the value `sun/net/httpserver/simpleserver/Main` instead of a corresponding Class entry.
Apparently, compiling anything with javac 22 with `--release 21` and dependency on jdk.httpserver works fine, but this breaks other tools which try to parse this file as a class file. Javap reports the following error:
Error: Not a ClassEntry at index: 6
JDK's classfile library fails with:
Exception in thread "main" java.lang.classfile.constantpool.ConstantPoolException: Not a ClassEntry at index: 6
at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:392)
at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readClassEntry(ClassReaderImpl.java:431)
at java.base/jdk.internal.classfile.impl.BoundAttribute$BoundModuleMainClassAttribute.mainClass(BoundAttribute.java:455)
And ASM fails with:
java.lang.ArrayIndexOutOfBoundsException: Index 36 out of bounds for length 18
at org.objectweb.asm.ClassReader.readUtf(ClassReader.java:3649)
at org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:3636)
at org.objectweb.asm.ClassReader.readStringish(ClassReader.java:3706)
at org.objectweb.asm.ClassReader.readClass(ClassReader.java:3721)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:515)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:395)
... which was originally discovered by a report to the Kotlin issue tracker at https://youtrack.jetbrains.com/issue/KT-67668.
Same problem happens with the version of this file in JDK 21 for releases 18..20 (`IJK/jdk.httpserver/module-info.sig`).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Unpack the JDK 22's `lib/ct.sym` zip archive
2) Rename the extracted file `L/jdk.httpserver/module-info.sig` to `module-info.class`
3) Run javap on this class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
javap should print the whole module definition without errors.
ACTUAL -
javap displays an error about the incorrect value of the `ModuleMainClass` attribute.
FREQUENCY : always