JDK-8200481 : Compiler crash while generating local variable debug information for inferred type
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-03-30
  • Updated: 2018-04-04
  • Resolved: 2018-04-04
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 11
11Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)

A DESCRIPTION OF THE PROBLEM :
The javac compiler crashes when generating local variable debug information for certain inferred types

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to compile the source code provided below with "javac -g" or "javac -g:vars" (both causing generation of debug info for local variables).


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Javac compiler terminates normally
ACTUAL -
Javac compiler crashes

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (10). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: Unexpected intersection type: java.lang.Throwable&java.lang.Cloneable
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.enterInner(ClassWriter.java:1043)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.classReference(ClassWriter.java:312)
	at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleClassSig(Types.java:5182)
	at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5114)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:291)
	at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:5120)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:291)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.typeSig(ClassWriter.java:334)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeCode(ClassWriter.java:1271)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1158)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1653)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1761)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1679)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:749)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1627)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1595)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:306)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
// Compile the code below with "javac -g BadClass.java":

// File: BadClass.java
public class BadClass {

    static void badMethod() {
        var foo = getFoo();
        var foos = wrapIntoArray(foo);
    }

    static <T extends Throwable & Cloneable> T getFoo() {
        return null;
    }

    @SafeVarargs
    static <T> T[] wrapIntoArray(T... array) {
        return array;
    }
}
---------- END SOURCE ----------


Comments
It seems to be corrected by JDK-8199910 fix.
04-04-2018

This issue is not applicable for 8 and 9. As the issue is reproducible only in presence of "var" usage. == var foo = getFoo(); var foos = wrapIntoArray(foo); above 2 lines causing "javac -g" to crash Object foo = getFoo(); Object foos = wrapIntoArray(foo); No crash observed here... ==
30-03-2018