Lambda testing

Roman Strobl roman.strobl at gmail.com
Mon Sep 24 12:24:45 PDT 2012


Hi,

I have been experimenting with the recent lambda build b56 from
http://jdk8.java.net/lambda/

I noticed two potential issues.

1. An unfinished lambda expression leads to a compiler AssertionError:

    public static void main(String[] args) {
        ();
    }

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.AssertionError
at com.sun.tools.javac.util.Assert.error(Assert.java:126)
at com.sun.tools.javac.tree.JCTree$Visitor.visitTree(JCTree.java:2455)
at com.sun.tools.javac.tree.JCTree$Visitor.visitErroneous(JCTree.java:2452)
at com.sun.tools.javac.tree.JCTree$JCErroneous.accept(JCTree.java:2269)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:832)
at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1637)
at
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1224)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:714)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:700)
at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:751)
at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1029)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:837)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:714)
at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:907)
at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:880)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:721)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2245)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:734)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1478)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1442)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:892)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:851)
at com.sun.tools.javac.main.Main.compile(Main.java:441)
at com.sun.tools.javac.main.Main.compile(Main.java:358)
at com.sun.tools.javac.main.Main.compile(Main.java:347)
at com.sun.tools.javac.main.Main.compile(Main.java:338)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)

2. When I try to create an interface with a method which has an
implementation but misses the "default" keyword, I get following error from
the compiler:

"error: interface methods cannot have body"

However with the introduction of default methods in JDK 8 this doesn't seem
to be completely true anymore, so perhaps a better message would be:

"error: abstract interface methods cannot have body" or "error: interface
methods cannot have body unless declared as default methods"

I can go ahead and raise these issues, just checking if this is already
known.

Thanks,

-Roman Strobl


More information about the lambda-dev mailing list