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

Regression: code with disjunctive type crashes javac

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b34
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      The following program crashes javac parser:

      class BadTest {
         Foo<? extends A|B> foo1 = null;
      }

      Output:


      Test.java:152: error: > expected
                  Foo<? extends A|B> foo1 = (Foo<? extends A|B>)(Foo<? extends Exception>)null;
                                 ^
      Test.java:152: error: ';' expected
                  Foo<? extends A|B> foo1 = (Foo<? extends A|B>)(Foo<? extends Exception>)null;
                                  ^
      Test.java:152: error: illegal start of type
                  Foo<? extends A|B> foo1 = (Foo<? extends A|B>)(Foo<? extends Exception>)null;
                                   ^
      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.util.Assert.check(Assert.java:45)
      at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:987)
      at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:752)
      at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:723)
      at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:679)
      at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:661)
      at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:651)
      at com.sun.tools.javac.parser.JavacParser.variableInitializer(JavacParser.java:1745)
      at com.sun.tools.javac.parser.JavacParser.variableDeclaratorRest(JavacParser.java:2401)
      at com.sun.tools.javac.parser.JavacParser.variableDeclaratorsRest(JavacParser.java:2372)
      at com.sun.tools.javac.parser.JavacParser.classOrInterfaceBodyDeclaration(JavacParser.java:2852)
      at com.sun.tools.javac.parser.JavacParser.classOrInterfaceBody(JavacParser.java:2775)
      at com.sun.tools.javac.parser.JavacParser.classDeclaration(JavacParser.java:2624)
      at com.sun.tools.javac.parser.JavacParser.classOrInterfaceOrEnumDeclaration(JavacParser.java:2565)
      at com.sun.tools.javac.parser.JavacParser.typeDeclaration(JavacParser.java:2554)
      at com.sun.tools.javac.parser.JavacParser.parseCompilationUnit(JavacParser.java:2495)
      at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:600)
      at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:637)
      at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:914)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:831)
      at com.sun.tools.javac.main.Main.compile(Main.java:435)
      at com.sun.tools.javac.main.Main.compile(Main.java:351)
      at com.sun.tools.javac.main.Main.compile(Main.java:342)
      at com.sun.tools.javac.Main.compile(Main.java:76)
      at com.sun.tools.javac.Main.main(Main.java:61)

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: