JDK-8309858 : javac failed to compile 3 tests with "java.lang.VerifyError: Illegal constant pool index 515 in class com.sun.tools.javac.tree.TreeInfo$DeclScanner"
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 22
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2023-06-12
  • Updated: 2025-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26Unresolved
Related Reports
Relates :  
Description
The following three tests failed to compile in the JDK22 CI:

javax/naming/directory/decodeobject/RunTest.java
javax/crypto/ModularProvider/JCEProviderServiceModularTest.java
java/util/ServiceLoader/restricted/RestrictedRun.java

Here's a log file snippet from the RunTest.java failure:

----------System.err:(43/2927)----------
An exception has occurred in the compiler (22-ea). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.VerifyError: Illegal constant pool index 515 in class com.sun.tools.javac.tree.TreeInfo$DeclScanner
Exception Details:
  Location:
    com/sun/tools/javac/tree/TreeInfo$DeclScanner.<init>(Lcom/sun/tools/javac/code/Symbol;)V @3: invokespecial
  Reason:
    Constant pool index 515 is invalid
  Bytecode:
    0000000: 2a2b 01b7 0203 b1                      

	at jdk.compiler/com.sun.tools.javac.tree.TreeInfo.declarationFor(TreeInfo.java:815)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$1(Annotate.java:279)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:200)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:157)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1796)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1062)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:935)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
	at jdk.test.lib.compiler.CompilerUtils.compile(CompilerUtils.java:122)
	at jdk.test.lib.compiler.CompilerUtils.compile(CompilerUtils.java:69)
	at RunTest.prepareTestClass(RunTest.java:99)
	at RunTest.run(RunTest.java:71)
	at RunTest.main(RunTest.java:67)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1583)
java.lang.RuntimeException: Compile failed.
	at RunTest.prepareTestClass(RunTest.java:100)
	at RunTest.run(RunTest.java:71)
	at RunTest.main(RunTest.java:67)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1583)

JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Compile failed.

The other two tests have the same failure mode.
Comments
Based on this mesg in the stderr log: An exception has occurred in the compiler (22-ea). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you. I filed this bug in tools/javac.
24-10-2023