Quality Outreach Heads-up - JDK 22: Annotation Processing Behavior Change

The OpenJDK Quality Group is promoting the testing of FOSS projects with OpenJDK builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.

JDK 22: Implicit Annotation Processing Behavior Change

As discussed in the July 2023 Quality Outreach update, starting in JDK 21 javac emits a note if implicit annotation processing is being used, that is, if one or more annotation processors are found and run from the class path when no explicit annotation processing configuration options are used.

The note is reported since, quoting from the note text:

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).

That future version of javac has arrived in JDK 22 b19+ with JDK-8306819 (“Consider disabling the compiler’s default active annotation processing”). In the situation where a note was emitted in JDK 21, in JDK 22 no note is emitted, and annotation processors are not run. To restore the previous behavior with respect to running annotation processors, add the -proc:full javac option.

Feedback on the annotation processing policy change can be sent to the compiler-dev mailing list.