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

Unable to combine --processor-module-path with unmodularized processors

XMLWordPrintable

    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      When trying to run javac with multiple annotation processors, only some of which have been modularized, it's impossible to run the modularized ones off of --processor-module-path: using "--processor-path" for the unmodularized ones gives "error: illegal combination of -processorpath and --processor-module-path", and using "--class-path" gives "error: plug-in not found: ErrorProne".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. download the JARs for Lombok and Error Prone:
          https://projectlombok.org/downloads/lombok.jar
          https://repo1.maven.org/maven2/com/google/errorprone/error_prone_core/2.5.1/error_prone_core-2.5.1-with-dependencies.jar
          https://repo1.maven.org/maven2/org/checkerframework/dataflow-shaded/3.7.1/dataflow-shaded-3.7.1.jar
          https://repo1.maven.org/maven2/com/google/code/findbugs/jFormatString/3.0.0/jFormatString-3.0.0.jar
      2. create a file Foo.java in the same folder with the contents as given below
      3. run Lombok only: javac --processor-module-path lombok.jar --class-path lombok.jar Foo.java
      4. add Error Prone: javac -XDcompilePolicy=simple --processor-path error_prone_core-2.5.1-with-dependencies.jar;dataflow-shaded-3.7.1.jar;jFormatString-3.0.0.jar -Xplugin:ErrorProne --processor-module-path lombok.jar --class-path lombok.jar Foo.java
      5. move Lombok from --processor-module-path to --processor-path: javac -XDcompilePolicy=simple --processor-path error_prone_core-2.5.1-with-dependencies.jar;dataflow-shaded-3.7.1.jar;jFormatString-3.0.0.jar;lombok.jar -Xplugin:ErrorProne --class-path lombok.jar Foo.java


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The javac invocation in step 4 works and the result is the same as the one of step 5.
      ACTUAL -
      The javac invocation in step 4 fails with:
      error: illegal combination of -processorpath and --processor-module-path

      ---------- BEGIN SOURCE ----------
      import lombok.Data;
      import java.util.Set;

      @Data
      class Foo {
          public static void main(String... args) {
              Set<Long> values = Set.of();
              if (values.contains(42)) {
                  System.out.println("Hello world!");
              }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Run modular annotation processors off of --processor-path as well

        1. Foo.java
          0.3 kB
        2. dependencies.zip
          10.15 MB

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: