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

Incorrect annotations.without.processors warnings with JDK 9

XMLWordPrintable

    • b04

        The JDK 9 javac emits annotations.without.processors warnings that were not present with JDK 8, and which appear to be incorrect:

        === P.java
        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 P extends AbstractProcessor {

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

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

        # JDK 8

        $ javac -fullversion -XDrawDiagnostics -Xlint:processing -processor P A.java
        javac full version "1.8.0_162-ea-b03"
        ... no warnings

        # JDK 9

        javac -fullversion -XDrawDiagnostics -Xlint:processing -processor
        P A.java
        javac full version "9.0.1+11"
        - compiler.warn.proc.annotations.without.processors: java.base/java.lang.Deprecated
        1 warning

              darcy Joe Darcy
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: