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

Duplicate Errors message when compiling with "javac -processor"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • tools
    • x86
    • linux

      FULL PRODUCT VERSION :
      java full version "1.6.0-b105"


      ADDITIONAL OS VERSION INFORMATION :
      Generic

      A DESCRIPTION OF THE PROBLEM :

      Problem with duplicate errors being output.
      javac warns that the class name doesn't match the file name.
      When run with a empty processor, the identical error gets output twice.
      See transcript below.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create the two source files as declared later and follow the steps in expected results.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -

      % javac -version
      javac 1.6.0
      % javac One.java
      One.java:1: class Two is public, should be declared in a file named
      Two.java
      public class Two { }
            ^
      1 error
      % javac EmptyProcessor.java
      % javac -processor EmptyProcessor One.java
      One.java:1: class Two is public, should be declared in a file named
      Two.java
      public class Two { }
            ^
      One.java:1: class Two is public, should be declared in a file named
      Two.java
      public class Two { }
            ^
      1 error

      ACTUAL -
      Get one error message in both cases.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      % cat One.java
      public class Two { }

      % cat EmptyProcessor.java
      import javax.annotation.processing.*;
      import java.util.Set;
      import javax.lang.model.element.TypeElement;
      import javax.lang.model.SourceVersion;

      @SupportedAnnotationTypes("*")
      @SupportedSourceVersion(SourceVersion.RELEASE_5)
      public class EmptyProcessor extends AbstractProcessor {
         @Override
         public boolean process(Set<? extends TypeElement> annotations,
      RoundEnvironment roundEnv) {
             return true;
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No work around

            darcy Joe Darcy
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: