Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8361499

intersection type cast causes javac crash with -Xjcov

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • 8, 11, 17, 25
    • tools
    • None

      This program crashes javac when the -Xjcov option is used:

      class Test {
         interface I { }
         void test() {
            Runnable r = (Runnable & I)() -> {};
         }
      }

      Stack trace:

      An exception has occurred in the compiler (11.0.27). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError
      at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.visitTree(CRTable.java:537)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$Visitor.visitTypeIntersection(JCTree.java:3125)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeIntersection.accept(JCTree.java:2457)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:200)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.visitTypeCast(CRTable.java:454)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:2038)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:200)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.visitVarDef(CRTable.java:254)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:972)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:200)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:213)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.visitBlock(CRTable.java:266)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1036)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:200)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.visitMethodDef(CRTable.java:247)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable$SourceComputer.csp(CRTable.java:200)
      at jdk.compiler/com.sun.tools.javac.jvm.CRTable.writeCRT(CRTable.java:94)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeCode(ClassWriter.java:1283)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1220)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1715)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1825)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1741)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1634)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1602)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)


      I can reproduce as far back as Java 8.

            vromero Vicente Arturo Romero Zaldivar
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: