crash in flow analysis

Liam Miller-Cushon cushon at google.com
Fri Oct 21 02:57:27 UTC 2016


The following snippet crashes javac 9ea+140. Is this a known issue?

The tree is copied a couple of times during speculative attribution, and
the break target isn't getting set for one of the copies.

abstract class Test {
  abstract void f(Runnable r);

  private void g() {
    f(
        () ->
            new Runnable() {
              public void run() {
                switch (42) {
                  default:
                    break;
                }
              }
            }.run());
  }
}
...
java.lang.AssertionError
        at com.sun.tools.javac.util.Assert.error(jdk.compiler at 9-ea
/Assert.java:155)
        at com.sun.tools.javac.util.Assert.check(jdk.compiler at 9-ea
/Assert.java:46)
        at
com.sun.tools.javac.comp.Flow$AliveAnalyzer.visitMethodDef(jdk.compiler at 9-ea
/Flow.java:524)
        at
com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(jdk.compiler at 9-ea
/JCTree.java:852)
        at com.sun.tools.javac.tree.TreeScanner.scan(jdk.compiler at 9-ea
/TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(jdk.compiler at 9-ea
/Flow.java:404)
        at
com.sun.tools.javac.comp.Flow$AliveAnalyzer.visitClassDef(jdk.compiler at 9-ea
/Flow.java:494)
        at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(jdk.compiler at 9-ea
/JCTree.java:760)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20161020/3e0d7e5b/attachment.html>


More information about the compiler-dev mailing list