checkers.util.count
Class Locations
java.lang.Object
javax.annotation.processing.AbstractProcessor
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 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:
-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, process, report, shouldSkip |
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
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