JDK-8078075 : Compilation Error (NPE)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u25,8u40,8u45
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux,windows_7
  • CPU: x86_64
  • Submitted: 2015-04-17
  • Updated: 2015-10-30
  • Resolved: 2015-10-30
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :


EXTRA RELEVANT SYSTEM CONFIGURATION :
kulxdesktop25 /var/tmp/wenjuny/tmp/java/lambda 74$ javac Lambda1.java        
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.DeferredAttr.attribSpeculative(DeferredAttr.java:386)
        at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:279)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:245)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:232)
        at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:993)
        at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:826)
        at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:731)
        at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:835)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:576)
        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$9.doLookup(Resolve.java:2415)
        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.resolveQualifiedMethod(Resolve.java:2412)
        at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2406)
        at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3395)
        at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3281)
        at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
        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: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)
kulxdesktop25 /var/tmp/wenjuny/tmp/java/lambda 75$ 



A DESCRIPTION OF THE PROBLEM :
package lambda;

public class Lambda1 {
    
    interface Function<T> {
        T compute(T n);
    }

    static <T> T operate(Function<T> f, T data) {
        return f.compute(data);
    }

    public static void main(String[] args) {
        System.out.println(operate((i) -> i * 2, 3));
    }

}



REPRODUCIBILITY :
This bug can be reproduced always.


Comments
Closing this as duplicate of JDK-8069545 having fix for JDK 8u60 ea b 10 and 9 ea b51 (checked with b60). Intimated submitter about the same.
30-10-2015

1) Run the attached test cases (Lambda1.java) 2) Checked this on Windows 7 and Linux-X64 with JDK 8u31, 8u40, 8u45, 8u60 ea b10, and 9 ea b60). **************************************************************************************** 8u31: 8u40: 8u45: 8u60 ea b10: 9 ea b59: ****************************************************************************************** Output of the testcase with 8u45: >javac Lambda1.java An exception has occurred in the compiler (1.8.0_45). Please file a bug at the Java Developer Connection (http://java.sun.c java.lang.AssertionError: attribution shouldn't be happening here at com.sun.tools.javac.util.Assert.error(Assert.java:133) at com.sun.tools.javac.util.Assert.check(Assert.java:94) at com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:591) at com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:479) at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:182) at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567) at com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:604) at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3797) at com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3584) at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3491) at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3470) at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3457) at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3201) at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566) at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1806) at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465) ...................... ...................... ***************************************** Output of the testcase with 8u60 ea b10: >javac Lambda1.java >java Lambda1 6 ******************************************************************************************* Result: This issue is reproducible with JDK 8u45 and 8u40. The issue is a duplicate of JDK-8069545 which has fix resolved for JDK 8u60 ea and 9 ea.
17-04-2015