Details
-
Bug
-
Resolution: Fixed
-
P3
-
8, 8-repo-lambda
-
b91
-
Verified
Description
Javac thows an exception compiling a lambda expression.
Source code of a test example is attached, the interesting part is:
public static final Comparator<ChronoLocalDate1> DATE_COMPARATOR3 =
( date1, date2) -> 0;
java.lang.NullPointerException
at com.sun.tools.javac.jvm.Code.emitop0(Code.java:538)
at com.sun.tools.javac.jvm.Items$SelfItem.load(Items.java:367)
at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:912)
at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1746)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1391)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1844)
at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1586)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1694)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1222)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:704)
at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:755)
at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1090)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:835)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:968)
at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:941)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:723)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2310)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:751)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1545)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1509)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:907)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:866)
at com.sun.tools.javac.main.Main.compile(Main.java:506)
at com.sun.tools.javac.main.Main.compile(Main.java:365)
at com.sun.tools.javac.main.Main.compile(Main.java:354)
at com.sun.tools.javac.main.Main.compile(Main.java:345)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)
The source compiles fine without the lambda expression.
It occurs in b67 and b72 of the JDK 8 EA builds and in recent private builds.
Source code of a test example is attached, the interesting part is:
public static final Comparator<ChronoLocalDate1> DATE_COMPARATOR3 =
( date1, date2) -> 0;
java.lang.NullPointerException
at com.sun.tools.javac.jvm.Code.emitop0(Code.java:538)
at com.sun.tools.javac.jvm.Items$SelfItem.load(Items.java:367)
at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:912)
at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1746)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1391)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1844)
at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1586)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1694)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1222)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:704)
at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:755)
at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1090)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:835)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:968)
at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:941)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:723)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2310)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:751)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1545)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1509)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:907)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:866)
at com.sun.tools.javac.main.Main.compile(Main.java:506)
at com.sun.tools.javac.main.Main.compile(Main.java:365)
at com.sun.tools.javac.main.Main.compile(Main.java:354)
at com.sun.tools.javac.main.Main.compile(Main.java:345)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)
The source compiles fine without the lambda expression.
It occurs in b67 and b72 of the JDK 8 EA builds and in recent private builds.
Attachments
Issue Links
- duplicates
-
JDK-8006680 NPE while generating code, in Gen
- Resolved
-
JDK-8013181 Compiler crashes (NullPointerException) trying to compile a class with a lambda
- Resolved
- is blocked by
-
JDK-8008687 MethodHandle code: allow static and invokespecial calls to interface methods
- Closed
- relates to
-
JDK-8012556 Implement lambda methods on interfaces as static
- Closed