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

AssertionError in TypeSymbol.getAnnotationTypeMetadata

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b154
    • Verification:
      Verified

      Backports

        Description

        The following program crashes during annotation processing with javac 9-ea+149:

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

        @SupportedAnnotationTypes("*")
        public class SimpleProcessor extends AbstractProcessor {

          @Override
          public SourceVersion getSupportedSourceVersion() {
            return SourceVersion.latestSupported();
          }

          @Override
          public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
            return false;
          }
        }
        ===

        ===
        class Test<Override> {
          Test(@Override String foo) {}
        }
        ===

        $ javac SimpleProcessor.java
        $ javac -processor SimpleProcessor Test.java
        java.lang.AssertionError: Only on ClassSymbol
                at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
                at jdk.compiler/com.sun.tools.javac.code.Symbol$TypeSymbol.getAnnotationTypeMetadata(Symbol.java:811)
                at jdk.compiler/com.sun.tools.javac.comp.Check.getAttributeTargetAttribute(Check.java:3140)
                at jdk.compiler/com.sun.tools.javac.comp.Check.annotationApplicable(Check.java:3074)
                at jdk.compiler/com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:2824)
                at jdk.compiler/com.sun.tools.javac.comp.Check.validateAnnotations(Check.java:2809)
                at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$1(Annotate.java:258)
                at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:186)
                at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:134)
                at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:591)
                at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:546)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1069)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:940)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:307)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:160)
                at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:55)
                at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:41)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                cushon Liam Miller-Cushon
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: