Summary
Reinstate the policy changes originally made under JDK-8317544: stop running annotation processors found on the class path by default. That behavior can still be enabled by using one or more separate options.
Problem
Starting in JDK 21, the message printed by JDK-8310061 is:
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.
This CSR is to implement the future disabling described in the message above.
Solution
Without other configuration options, do not search the class path for annotation processors.
In more detail, the only change in behavior occurs when the class path is set and no explicit annotation processing configuration is set.
Specification
Update to javac
man page:
diff --git a/src/jdk.compiler/share/man/javac.1 b/src/jdk.compiler/share/man/javac.1
index de374e7d0c7..fe03bab8b45 100644
--- a/src/jdk.compiler/share/man/javac.1
+++ b/src/jdk.compiler/share/man/javac.1
@@ -1712,8 +1712,15 @@ The API for annotation processors is defined in the
packages and subpackages.
.SS How Annotation Processing Works
.PP
-Unless annotation processing is disabled with the
-\f[B]\f[VB]-proc:none\f[B]\f[R] option, the compiler searches for any
+Annotation processing is requested by using an option to configure
+annotation processing, such as \f[B]\f[VB]-processor\f[B]\f[R],
+\f[B]\f[VB]--processor-path\f[B]\f[R],
+\f[B]\f[VB]--processor-module-path\f[B]\f[R] or by explicitly enabling
+processing with the \f[B]\f[VB]-proc:full\f[B]\f[R] or
+\f[B]\f[VB]-proc:only\f[B]\f[R] options. Annotation processing is
+disabled using the \f[B]\f[VB]-proc:none\f[B]\f[R] option.
+.PP
+If annotation processing is requested, the compiler searches for any
annotation processors that are available.
The search path can be specified with the
\f[B]\f[VB]-processorpath\f[B]\f[R] option.
- csr of
-
JDK-8321314 Reinstate disabling the compiler's default active annotation processing
- Resolved
- relates to
-
JDK-8317544 Consider disabling the compiler's default active annotation processing
- Closed
-
JDK-8321321 Defer policy of disabling annotation processing by default
- Closed
-
JDK-8344477 javac states that -proc:full is the default but the default as of 23 is -proc:none
- Closed