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

Reinstate disabling the compiler's default active annotation processing

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 23
    • tools
    • None
    • behavioral
    • medium
    • Hide
      Since JDK-8306819, support for '-proc:full' has been backported to earlier update release trains and the Maven compiler plugin has been updated to allow '-proc:full' to be passed as a configuration parameter. This should ease the impact of the behavioral change.
      Show
      Since JDK-8306819 , support for '-proc:full' has been backported to earlier update release trains and the Maven compiler plugin has been updated to allow '-proc:full' to be passed as a configuration parameter. This should ease the impact of the behavioral change.
    • add/remove/modify command line option
    • JDK

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              darcy Joe Darcy
              Brian Goetz, Jonathan Gibbons, Vicente Arturo Romero Zaldivar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: