JDK-8068956 : Internal compiler error
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u25
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2015-01-13
  • Updated: 2015-10-30
  • Resolved: 2015-10-30
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
The following program does causes exception in the compiler.




STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java


ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_25). 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.isConvertible(Types.java:290)
	at com.sun.tools.javac.comp.Check.assertConvertible(Check.java:922)
	at com.sun.tools.javac.comp.Check.checkMethod(Check.java:876)
	at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3838)
	at com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3615)
	at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3522)
	at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3501)
	at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3488)
	at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3237)
	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.visitReturn(Attr.java:1704)
	at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1384)
	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:1142)
	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.visitMethodDef(Attr.java:1035)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
	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 ----------
import java.util.function.BinaryOperator;

public final class Test {

    public long sum(long x) {
        return doReduce(x, (a, b) -> a + b);
    }

    private <V> V doReduce(V x, BinaryOperator<V> accumulator) {
        return x;
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
import java.util.function.BinaryOperator;

public final class Test {

    public long sum(long x) {
        Long y = doReduce(x, (a, b) -> a + b);
        return y;
    }

    private <V> V doReduce(V x, BinaryOperator<V> accumulator) {
        return x;
    }
}


Comments
This seems resolved in JDK 8u40. Closing this as duplicate of JDK-8044546.
14-01-2015

Could reproduce this with JDK 8u20 and 8u25. JDK 8, 8u5 and 8u11, 8u40 works fine.
14-01-2015