checkers.util.count
Class Locations

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

@SupportedOptions(value={"nolocations","annotations"})
@SupportedSourceVersion(value=RELEASE_7)
public class Locations
extends SourceChecker

A utility class for counting the potential locations 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.

Counting the number of lines of the processor's output yields the annotation location count (e.g., by piping the output to wc). Because the processor outputs a single line of text describing type of each annotation location it encounters, you can obtain the count for specific annotation location types (i.e., possible local variable annotations, or possible method receiver annotations) by filtering the output accordingly (e.g., with grep).

By default, this utility displays annotation locations only. The following two options may be used to adjust the output:


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
Locations()
           
 
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.
 
Methods inherited from class checkers.source.SourceChecker
createFactory, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, process, 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

Locations

public Locations()
Method Detail

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