JDK-6727243 : Duplicate Errors message when compiling with "javac -processor"
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2008-07-18
  • Updated: 2011-02-16
  • Resolved: 2008-07-23
Related Reports
Duplicate :  
Description
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

Comments
EVALUATION Yes, a known limitation with the current javac annotation processing implementation, duplicate of bug 6727243.
23-07-2008