checkers.util.count
Class Locations

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by com.sun.source.util.AbstractTypeProcessor
          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 listing 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, and supply the argument:

-processor checkers.util.count.Locations

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
Modifier and Type Field and Description
 
Fields inherited from class checkers.source.SourceChecker
currentPath, currentRoot, env, messager, messages, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
Constructor and Description
Locations()
           
 
Method Summary
Modifier and Type Method and Description
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, fullMessageOf, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, report, typeProcess
 
Methods inherited from class com.sun.source.util.AbstractTypeProcessor
process, typeProcessingOver
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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