-
Bug
-
Resolution: Fixed
-
P2
-
10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8202809 | 10u-cpu | Maurizio Cimadamore | P2 | Resolved | Fixed | master |
JDK-8202736 | 10.0.2 | Maurizio Cimadamore | P2 | Closed | Fixed | b06 |
JDK-8202538 | 10u-open | Maurizio Cimadamore | P2 | Resolved | Fixed | master |
This code crashes the compiler with `-g` option.
```
public class Main {
void m() {
var s = java.util.List.of("a", 1);
}
}
```
$ javac Main.java -g
C:\src>javac Main.java -g
java.lang.AssertionError: Unexpected intersection type: java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>
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:5225)
at jdk.compiler/com.sun.tools.javac.code.Types$SignatureGenerator.assembleClassSig(Types.java:5201)
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.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)
The cause is about intersection. The variable type that is infered becomes as a type with intersection, and will crash the compiler when generating a debug info.
These are no problem.
var s=List.of("a");
var s=List.of("a", 1, Optional.empty());
var s=List.of("a", 1, List.of());
- backported by
-
JDK-8202538 Compiler crashes with -g option and variables of intersection type inferred by `var`
- Resolved
-
JDK-8202809 Compiler crashes with -g option and variables of intersection type inferred by `var`
- Resolved
-
JDK-8202736 Compiler crashes with -g option and variables of intersection type inferred by `var`
- Closed
- duplicates
-
JDK-8203038 AssertionError on intersection types in throws clause with all debugging info
- Closed
-
JDK-8200481 Compiler crash while generating local variable debug information for inferred type
- Closed
-
JDK-8205161 Local variable type inference Unexpected intersection type
- Closed
- relates to
-
JDK-6999635 Multicatch: crash while compiling simple code with a multicatch parameter
- Closed
-
JDK-7005371 Multicatch: assertion error while generating LocalVariableTypeTable attribute
- Closed
-
JDK-8205161 Local variable type inference Unexpected intersection type
- Closed
-
JDK-8200355 local variable inference regression test generates classfile in test folder
- Resolved