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

Incorrect warnings about implicit annotation processing

XMLWordPrintable

    • b14

        Consider code like:
        ---
                        com.sun.source.util.JavacTask task =
                                (com.sun.source.util.JavacTask) provider.getTask(compilerOut, null, null, options, null, inputFile);

                        Processor processor =
                                (Processor) processorClass.getDeclaredConstructor().newInstance();

                        task.setProcessors(List.of(processor));
                        task.analyze();
        ---

        This will produce warning like:
        ---
        Note: 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.
        ---

        which is incorrect, as the processors where passed in using the API.

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: