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

Compiler crashes trying to cast UnionType to IntersectionClassType

    Details

    • Subcomponent:
    • Resolved In Build:
      b53
    • Verification:
      Verified

      Backports

        Description


        just try to build their product with Java 8 and got the following error below
        from java compiler:


        class.only:

            [mkdir] Created dir: L:\arb_wcArbortext\SIS\RulesPartsEditor\src_gen
            [javac] Compiling 106 source files to
        L:\arb_wcArbortext\SIS\RulesPartsEditor\codebase
            [javac] Annotation processing round 1 complete -- 5 file(s) generated.
            [javac] Annotation processing round 2 complete -- 1 file(s) generated.
            [javac] Annotation processing generation COMPLETE. ALL ERRORS BEYOND
        THIS POINT ARE REAL!!!
            [javac] An exception has occurred in the compiler (1.8.0_25). 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.
            [javac] java.lang.ClassCastException:
        com.sun.tools.javac.code.Type$UnionClassType cannot be cast to
        com.sun.tools.javac.code.Type$IntersectionClassType
            [javac] at
        com.sun.tools.javac.code.Types$8.visitClassType(Types.java:1540)
            [javac] at
        com.sun.tools.javac.code.Types$8.visitClassType(Types.java:1497)
            [javac] at
        com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
            [javac] at
        com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
            [javac] at
        com.sun.tools.javac.code.Types.isCastable(Types.java:1488)
            [javac] at
        com.sun.tools.javac.comp.Check.checkCastable(Check.java:568)
            [javac] at
        com.sun.tools.javac.comp.Check.checkCastable(Check.java:565)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitTypeTest(Attr.java:3146)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCInstanceOf.accept(JCTree.java:1840)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitParens(Attr.java:2990)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:1661)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:649)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitIf(Attr.java:1599)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1269)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitTry(Attr.java:1395)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1173)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitIf(Attr.java:1600)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1269)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitForeachLoop(Attr.java:1207)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1035)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1035)
            [javac] at
        com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4342)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4252)
            [javac] at
        com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4181)
            [javac] at
        com.sun.tools.javac.comp.Attr.attrib(Attr.java:4156)
            [javac] at
        com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
            [javac] at
        com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
            [javac] at
        com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
            [javac] at
        com.sun.tools.javac.main.Main.compile(Main.java:523)
            [javac] at
        com.sun.tools.javac.main.Main.compile(Main.java:381)
            [javac] at
        com.sun.tools.javac.main.Main.compile(Main.java:370)
            [javac] at
        com.sun.tools.javac.main.Main.compile(Main.java:361)
            [javac] at com.sun.tools.javac.Main.compile(Main.java:56)
            [javac] at com.sun.tools.javac.Main.main(Main.java:42)


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mcimadamore Maurizio Cimadamore
                  Reporter:
                  shadowbug Shadow Bug
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: