checkers.util.count
Class Locations
java.lang.Object
javax.annotation.processing.AbstractProcessor
com.sun.source.util.AbstractTypeProcessor
checkers.source.SourceChecker
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:
-Anolocations
: suppresses location output
-Aannotations
: enables annotation output
Methods inherited from class checkers.source.SourceChecker |
createFactory, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, report, typeProcess |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Locations
public Locations()
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