FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When dealing with a type for which no instance is possible, where one wildcard parameter indirectly has two separate classes (which aren't a supertype of eachother) as supertype, the compiler can crash with a NPE.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the given code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An error message about the types, or compiling without errors
ACTUAL -
Compiler crash
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.6.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.TransTypes.retype(TransTypes.java:135)
at com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:566)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:398)
at com.sun.tools.javac.comp.TransTypes.visitExec(TransTypes.java:529)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1074)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:56)
at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:146)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:398)
at com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:432)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:56)
at com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:120)
at com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:742)
at com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:419)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:398)
at com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:765)
at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1182)
at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1118)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
at com.sun.tools.javac.main.Main.compile(Main.java:353)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:69)
at com.sun.tools.javac.Main.main(Main.java:54)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class ImpossibleTypeCrash<P extends Double, Q extends P> {
Q q;
void m(ImpossibleTypeCrash<? extends Object, ? extends Integer> itp) {
itp.q.clone();
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u10
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.