JDK-8006680 : NPE while generating code, in Gen
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2013-01-22
  • Updated: 2013-09-12
  • Resolved: 2013-04-18
Related Reports
Duplicate :  
Relates :  
Description
The following JCK Compiler tests fail:
lang/INTF/intf018/intf01802m01/intf01802m01.html
lang/INTF/intf018/intf01802m11/intf01802m11.html
lang/INTF/intf018/intf01803m01/intf01803m01.html
lang/INTF/intf018/intf01803m11/intf01803m11.html

The following exception is produced when compiling JCK tests:

An exception has occurred in the compiler (1.8.0-ea). 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.jvm.Code.emitop0(Code.java:537)
	at com.sun.tools.javac.jvm.Items$SelfItem.load(Items.java:367)
	at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:911)
	at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1745)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1410)
	at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:892)
	at com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1843)
	at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1617)
	at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:892)
	at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1693)
	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1240)
	at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:682)
	at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:717)
	at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:703)
	at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:754)
	at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1089)
	at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:852)
	at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:682)
	at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:717)
	at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:967)
	at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:940)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:736)
	at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:682)
	at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2309)
	at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:752)
	at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1522)
	at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1486)
	at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:908)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:867)
	at com.sun.tools.javac.main.Main.compile(Main.java:482)
	at com.sun.tools.javac.main.Main.compile(Main.java:363)
	at com.sun.tools.javac.main.Main.compile(Main.java:352)
	at com.sun.tools.javac.main.Main.compile(Main.java:343)
	at com.sun.tools.javac.Main.compile(Main.java:76)
	at com.sun.tools.javac.Main.main(Main.java:61)
Comments
Reduced test case: interface fint { int get(); } interface atype { fint fld = ()->1; } This line in LambdaToMethod is wrong: translatedSym.flags_field = SYNTHETIC | (needInstance? 0 : STATIC) | (inInterface? PUBLIC | DEFAULT : PRIVATE); This is effectively desugaring a lambda into an instance default method even when lambda occurs in a static context.
22-01-2013