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

javac crashes while adding type annotations to the return type of a constructor

XMLWordPrintable

    • b23
    • b26
    • Verified

        It's observed that some of the JCK tests related to Annotation processing are failing in JDK 22-b23 with "java.lang.AssertionError: Cannot add metadata to this type: VOID"
        Possibly a regression caused by - https://bugs.openjdk.org/browse/JDK-8225377

        The tests are passing with JDK22-b22.

        Attaching the sample AnnotationProcessor with sample target class file (Tester)

        Here is the observation :
        ====

        With b-22 ( Tester class successfully parsed by Annotation Processor)
        ====
        /scratch/jdk-cache/22/22/jdk-22/bin/javac -processor AnnoProc Tester
        init...
        process...
          annotations []

        With b-23 ( java.lang.AssertionError: Cannot add metadata to this type: VOID )
        ====

         /scratch/jdk-cache/22/23/jdk-22/bin/javac -processor AnnoProc Tester
        An exception has occurred in the compiler (22-ea). 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: Cannot add metadata to this type: VOID
                at jdk.compiler/com.sun.tools.javac.code.Type.cloneWithMetadata(Type.java:351)
                at jdk.compiler/com.sun.tools.javac.code.Type.addMetadata(Type.java:390)
                at jdk.compiler/com.sun.tools.javac.code.Type.annotatedType(Type.java:456)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationTypeMapping.reannotate(ClassReader.java:2548)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationTypeMapping.visitType(ClassReader.java:2568)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationTypeMapping.visitType(ClassReader.java:2523)
                at jdk.compiler/com.sun.tools.javac.code.Type.accept(Type.java:223)
                at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4894)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationSymbolVisitor.addTypeAnnotations(ClassReader.java:2426)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationSymbolVisitor.addTypeAnnotations(ClassReader.java:2394)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationSymbolVisitor.visitMethodSymbol(ClassReader.java:2335)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationSymbolVisitor.visitMethodSymbol(ClassReader.java:2286)
                at jdk.compiler/com.sun.tools.javac.code.Symbol$MethodSymbol.accept(Symbol.java:2271)
                at jdk.compiler/com.sun.tools.javac.code.Types$DefaultSymbolVisitor.visit(Types.java:4921)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.addTypeAnnotationsToSymbol(ClassReader.java:2283)
                at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$TypeAnnotationCompleter.run(ClassReader.java:2266)
                at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:191)
                at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:322)
                at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:682)
                at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1418)
                at jdk.compiler/com.sun.tools.javac.code.ClassFinder.loadClass(ClassFinder.java:446)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.resolveBinaryNameOrIdent(JavaCompiler.java:730)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.resolveBinaryNameOrIdent(JavaCompiler.java:719)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1239)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
                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)


         



              vromero Vicente Arturo Romero Zaldivar
              kganapureddy Krushnareddy Ganapureddy
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: