Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901643

Avoid @javax.annotation.Generated for better post-modular compatibility

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • None
    • tools
    • None
    • jmh

      See JDK-8152842. In a post-modular world, javax.annotation.Generated is not easily accessible:

      [WARNING] at org.openjdk.jmh.generators.core.BenchmarkGenerator.generateImport(BenchmarkGenerator.java:582)
         at org.openjdk.jmh.generators.core.BenchmarkGenerator.generateClass(BenchmarkGenerator.java:540)
         at org.openjdk.jmh.generators.core.BenchmarkGenerator.generate(BenchmarkGenerator.java:94)
         at org.openjdk.jmh.generators.BenchmarkProcessor.process(BenchmarkProcessor.java:58)
         at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(jdk.compiler@9-ea/JavacProcessingEnvironment.java:958)
         at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(jdk.compiler@9-ea/JavacProcessingEnvironment.java:874)
         at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(jdk.compiler@9-ea/JavacProcessingEnvironment.java:106)
         at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(jdk.compiler@9-ea/JavacProcessingEnvironment.java:1181)
         at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(jdk.compiler@9-ea/JavacProcessingEnvironment.java:1289)
         at com.sun.tools.javac.main.JavaCompiler.processAnnotations(jdk.compiler@9-ea/JavaCompiler.java:1229)
         at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-ea/JavaCompiler.java:903)
         at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:261)
         at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:143)
         at com.sun.tools.javac.Main.compile(jdk.compiler@9-ea/Main.java:55)
         at com.sun.tools.javac.Main.main(jdk.compiler@9-ea/Main.java:41)
        Caused by: java.lang.ClassNotFoundException: javax.annotation.Generated
         at java.net.URLClassLoader.findClass(java.base@9-ea/URLClassLoader.java:384)
         at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:486)
         at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:419)
         ... 15 more

      The workaround is to avoid emitting @Generated altogether.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: