bumped into a compiler NPE when replaced lambda with an anonymous class
Dmitry Bessonov
dmitry.bessonov at oracle.com
Thu Feb 14 06:38:55 PST 2013
Attempt to compile with b77 a minimized (to some extent) code:
--------------------------------------------------------------
public class CompilerError {
public static void main(String[] args) {
Bar bar = a -> a.aMethod((ClassB) () -> new ClassB() {
public void bMethod() {
}
});
}
public static interface Bar {
void barMethod(ClassA a);
}
public interface ClassA {
public void aMethod(Object t);
}
public interface ClassB {
public void bMethod();
}
}
--------------------------------------------------------------
leads to
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.visitNewClass(Gen.java:1831)
at
com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1491)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1697)
at
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1271)
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:1093)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:884)
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:771)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2355)
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:505)
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)
-Dmitry
More information about the lambda-dev
mailing list