JDK-8193214 : Incorrect annotations.without.processors warnings with JDK 9
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9,10,11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-12-07
  • Updated: 2021-06-30
  • Resolved: 2018-07-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11.0.13-oracleFixed 12 b04Fixed
Related Reports
Relates :  
Relates :  
Description
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
Comments
Fix Request (11u) JDK 9 regression, fixed in JDK 12, but not in JDK 11. Prevents compiling Java projects with JDK 11 and -Xlint:processing when annotation processors are enabled. Patch applies cleanly. The only affected code path seems to be Xlint itself, and nothing else. New test fails without the patch, passes with it.
24-06-2021

The annotations without processors warning is meant to filter out platform annotations and is done by on the names of the annotations. The addition of modules seems to have changed the reported names so that the existing whitelist doesn't work, which should be easy to correct.
14-12-2017