public class Locations extends SourceChecker
javac -proc:only -processor checkers.util.count.Locations MyFile.java ...
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:
-Aannotations
: prints, on the same line as each location,
information about the annotation that is written there, if any-Anolocations
: suppresses location output;
only makes sense in conjunction with -Aannotations
SourceChecker.CheckerError
currentPath, currentRoot, messager, messages, trees
processingEnv
Constructor and Description |
---|
Locations() |
Modifier and Type | Method and Description |
---|---|
protected SourceVisitor<?,?> |
createSourceVisitor(@Nullable CompilationUnitTree root)
Provides the
SourceVisitor that the checker should use to scan
input source trees. |
createFactory, errorAbort, errorAbort, formatStackTrace, fullMessageOf, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getProperties, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, initChecker, message, report, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, typeProcess, typeProcessingStart
init, process, typeProcessingOver
getCompletions, isInitialized, toString
protected SourceVisitor<?,?> createSourceVisitor(@Nullable CompilationUnitTree root)
SourceChecker
SourceVisitor
that the checker should use to scan
input source trees.createSourceVisitor
in class SourceChecker
root
- the AST rootSourceVisitor
to use to scan source trees