Details

    • Type: Bug
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None

      Description

      My colleague Eddie Aftandilian discovered the following crash, in which a syntax error causes the compiler to assert that it has fallen into an infinite loop.

      It does not repro in 8, but it does repro in all javac versions > 8, including 15-ea. It only repros with annotation processing enabled, but it doesn't matter what the annotation processor actually does.

      === EmptyProcessor.java
      import java.util.Set;
      import javax.annotation.processing.AbstractProcessor;
      import javax.annotation.processing.RoundEnvironment;
      import javax.lang.model.element.TypeElement;

      public class EmptyProcessor extends AbstractProcessor {
        @Override
        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
          return false;
        }
      }
      === Repro.java
      public class Repro {
        private static final ImmutableSetMultimap<String, Class<?>>
            MY_MAP =
                ImmutableSetMultimap.<String, Class<?>>builder()
                    .putAll(
                        "foo") // syntax error
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class,
                        String.class)
                    .build();
      }
      ===
      $ javac -fullversion
      javac full version "15-ea+2-44"
      $ javac EmptyProcessor.java
      $ javac -processor EmptyProcessor Repro.java
      An exception has occurred in the compiler (15-ea). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler 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.util.Assert.check(Assert.java:46)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.reportSyntaxError(JavacParser.java:443)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.reportSyntaxError(JavacParser.java:424)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.accept(JavacParser.java:465)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.accept(JavacParser.java:454)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classInterfaceOrRecordBody(JavacParser.java:3983)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classDeclaration(JavacParser.java:3715)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classOrRecordOrInterfaceOrEnumDeclaration(JavacParser.java:3657)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.typeDeclaration(JavacParser.java:3646)
              at jdk.compiler/com.sun.tools.javac.parser.JavacParser.parseCompilationUnit(JavacParser.java:3490)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:639)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:676)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:1031)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:1018)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:938)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:316)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              amalloy Alan Malloy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: