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

Assertion due to Type.addMetadata adding annotations to already-annotated type

XMLWordPrintable

    • b09
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :


      A DESCRIPTION OF THE PROBLEM :
      Assertion due to Type.addMetadata adding annotations to already-annotated type. Javac appears to try to annotate a type twice during certain erroneous compilations. It should produce a compile error report, but throws instead.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You will need:

      https://github.com/CCBlueX/LiquidBounce commit 5170bccb9416c667ad8f399b8f624d525d93826d

      Jars:
      Jetbrains annotations 20.1.0 from https://mvnrepository.com/artifact/org.jetbrains/annotations/20.1.0
      Kotlin compiler emeddable 1.9.0 from https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.9.0

      Now run:

      /tmp/jdk-22.jdk/Contents/Home/bin/javac src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/gui/MixinChatInputSuggestor.java -cp /tmp/jars/annotations-20.1.0.jar:/tmp/jars/kotlin-compiler-embeddable-1.9.0.jar

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation errors, since many jars and other source files are missing from the compile command.
      ACTUAL -
      Note: Annotation processing is enabled because one or more processors were found
        on the class path. A future release of javac may disable annotation processing
        unless at least one processor is specified by name (-processor), or a search
        path is specified (--processor-path, --processor-module-path), or annotation
        processing is enabled explicitly (-proc:only, -proc:full).
        Use -Xlint:-options to suppress this message.
        Use -proc:none to disable annotation processing.
      An exception has occurred in the compiler (22). 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, 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.code.Type.addMetadata(Type.java:389)
      at jdk.compiler/com.sun.tools.javac.code.Type.annotatedType(Type.java:456)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitErrorType(TypeAnnotations.java:670)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitErrorType(TypeAnnotations.java:597)
      at jdk.compiler/com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:2378)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:679)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:546)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:367)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1242)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1022)
      at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:295)
      at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:58)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1115)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
      at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:295)
      at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.lambda$organizeTypeAnnotationsSignatures$0(TypeAnnotations.java:133)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:197)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:157)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1827)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1081)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:947)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)

      ---------- BEGIN SOURCE ----------
      Available at the git commit described in steps to reproduce.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Problem only affects erroneous compilations.

      FREQUENCY : always


            abimpoudis Angelos Bimpoudis
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: