[Checkers] Duplicated Errors
Mahmood Ali
mahmood at MIT.EDU
Fri Jul 4 10:43:14 EDT 2008
Greetings,
This is in response to the bug report regarding duplicated errors.
The details from TODO.txt (for archival purposes) is copied below.
The bug is not a JSR 308 bug, but rather it's a javac 6 (I didn't
check against javac 5). Here is my transcript for the bug report.
- Mahmood
> % javac -versionjavac 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
> % 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;
> }
> }
> %
--------------------------------- Bug Report
----------------------------------
> Problem with duplicate errors being output.
>
> Consider a file WrongFileName.java with the following contents:
>
> public class TheClassNameDoesntMatchTheFileName { }
>
> javac warns that the class name doesn't match the file name.
> When run with a type processor, the identical error gets output twice.
> See transcript below.
>
> % javac WrongFileName.java
> WrongFileName.java:1: class TheClassNameDoesntMatchTheFileName is
> public, should be declared in a file named
> TheClassNameDoesntMatchTheFileName.java
> public class TheClassNameDoesntMatchTheFileName { }
> ^
> 1 error
> % javac -typeprocessor checkers.interning.InterningChecker
> WrongFileName.java
> WrongFileName.java:1: class TheClassNameDoesntMatchTheFileName is
> public, should be declared in a file named
> TheClassNameDoesntMatchTheFileName.java
> public class TheClassNameDoesntMatchTheFileName { }
> ^
> WrongFileName.java:1: class TheClassNameDoesntMatchTheFileName is
> public, should be declared in a file named
> TheClassNameDoesntMatchTheFileName.java
> public class TheClassNameDoesntMatchTheFileName { }
> ^
> 1 error
More information about the checkers
mailing list