bug - lambda expression in instance initializer in annon/local class
Zhong Yu
zhong.j.yu at gmail.com
Fri Sep 6 16:43:48 PDT 2013
This code does not compile (jdk8ea build 104)
public class Tmp
{
void test()
{
new Object()
{
Runnable r = ()->{};
};
class X
{
Runnable r = ()->{};
}
}
}
Information:Using javac 1.8.0-ea to compile java sources
Information:java: 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.
Information:java: java.lang.ClassCastException:
com.sun.tools.javac.code.Symbol$ClassSymbol cannot be cast to
com.sun.tools.javac.code.Symbol$MethodSymbol
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.visitLambda(LambdaToMethod.java:252)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1609)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:183)
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:176)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitVarDef(TreeTranslator.java:153)
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.visitVarDef(LambdaToMethod.java:441)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:846)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:134)
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.visitClassDef(LambdaToMethod.java:223)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:687)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitNewClass(TreeTranslator.java:283)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1510)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitExec(TreeTranslator.java:245)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1290)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:162)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:903)
Information:java: at
com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:145)
Information:java: at
com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:772)
Information:java: at
com.sun.tools.javac.comp.LambdaToMethod.translateTopLevelClass(LambdaToMethod.java:203)
Information:java: at
com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1442)
Information:java: at
com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1327)
Information:java: at
com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:877)
Information:java: at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:836)
Information:java: at com.sun.tools.javac.main.Main.compile(Main.java:518)
Information:java: at
com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
Information:java: at
com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
Information:java: at
org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:166)
Information:java: at
org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:364)
Information:java: at
org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:276)
Information:java: at
org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:190)
Information:java: at
org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:162)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:998)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:739)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:770)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:702)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:523)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:314)
Information:java: at
org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:179)
Information:java: at
org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
Information:java: at
org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:220)
Information:java: at
org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:112)
Information:java: at
org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:132)
Information:java: at
org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
Information:java: at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Information:java: at
java.util.concurrent.FutureTask.run(FutureTask.java:266)
Information:java: at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
Information:java: at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Information:java: at java.lang.Thread.run(Thread.java:724)
Information:java: Errors occurred while compiling module 'dev'
Information:Compilation completed with 1 error and 0 warnings in 2 sec
Information:1 error
Information:0 warnings
Error:java: Compilation failed: internal java compiler error
More information about the compiler-dev
mailing list