FULL PRODUCT VERSION :
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The compiler throws an NPE instead of reporting a compiler error
REGRESSION. Last worked in version 7u67
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the attached java file with javac
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Example.java:4: error: unexpected type
static <A extends String[]> void f(A x) { }
^
required: class
found: String[]
1 error
ACTUAL -
An exception has occurred in the compiler (1.8.0_31). 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.code.Types.lub(Types.java:3562)
at com.sun.tools.javac.code.Types.lub(Types.java:3520)
at com.sun.tools.javac.comp.Infer.getParameterizedSupers(Infer.java:624)
at com.sun.tools.javac.comp.Infer.access$200(Infer.java:64)
at com.sun.tools.javac.comp.Infer$IncorporationStep$7.apply(Infer.java:785)
at com.sun.tools.javac.comp.Infer.checkWithinBounds(Infer.java:551)
at com.sun.tools.javac.comp.Infer$GraphSolver.solve(Infer.java:1576)
at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2198)
at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2190)
at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2205)
at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:186)
at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:564)
at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1431)
at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1618)
at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1689)
at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1662)
at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1822)
at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2383)
at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3074)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3325)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3310)
at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2379)
at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3170)
at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1843)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:656)
at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1611)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1136)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4342)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4252)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4181)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4156)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.main.Main.compile(Main.java:381)
at com.sun.tools.javac.main.Main.compile(Main.java:370)
at com.sun.tools.javac.main.Main.compile(Main.java:361)
at com.sun.tools.javac.Main.compile(Main.java:56)
at com.sun.tools.javac.Main.main(Main.java:42)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Example {
{ f(g(null)); }
static <A extends String[]> void f(A x) { }
static <S> S g(S s) { return s; }
}
---------- END SOURCE ----------