checkers.util.count
Class AnnotationsCounter

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by checkers.source.SourceChecker
          extended by checkers.util.count.AnnotationsCounter
All Implemented Interfaces:
Processor

public class AnnotationsCounter
extends SourceChecker

A utility class for counting the occurrences of annotations

The class is actually an annotation processor; in order to use it, invoke the compiler on the source file(s) for which you wish to count annotations locations. You may also wish to use the -proc:only javac option to stop compilation after annotation processing.


Field Summary
 
Fields inherited from class checkers.source.SourceChecker
currentRoot, env, messager, messages, skipPattern, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
AnnotationsCounter()
           
 
Method Summary
protected  boolean attribute(Set<? extends TypeElement> elements)
          No need for type-checking.
protected  SourceVisitor<?,?> createSourceVisitor(CompilationUnitTree root)
          Provides the SourceVisitor that the checker should use to scan input source trees.
protected  void incrementCount(Name annoName)
           
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
          Type-check the code with Java specifications and then runs the Checker Rule Checking visitor on the processed source.
 
Methods inherited from class checkers.source.SourceChecker
createFactory, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, report, shouldSkip
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationsCounter

public AnnotationsCounter()
Method Detail

incrementCount

protected void incrementCount(Name annoName)

process

public boolean process(Set<? extends TypeElement> annotations,
                       RoundEnvironment roundEnv)
Description copied from class: SourceChecker
Type-check the code with Java specifications and then runs the Checker Rule Checking visitor on the processed source. The Processor is invoked in the annotation processing phase, before the code is type-checked by the compiler. This method ensures that only Java valid code is processed by the Rule Checking visitor.

Specified by:
process in interface Processor
Overrides:
process in class SourceChecker
See Also:
Processor.process(Set, RoundEnvironment)

createSourceVisitor

protected SourceVisitor<?,?> createSourceVisitor(CompilationUnitTree root)
Description copied from class: SourceChecker
Provides the SourceVisitor that the checker should use to scan input source trees.

Specified by:
createSourceVisitor in class SourceChecker
Parameters:
root - the AST root
Returns:
a SourceVisitor to use to scan source trees

attribute

protected boolean attribute(Set<? extends TypeElement> elements)
No need for type-checking. Elemenates need for setting all classpaths

Overrides:
attribute in class SourceChecker
Returns:
true iff if the code type-checks with Java Specification