@SupportedOptions(value={"nolocations","annotations"}) @SupportedSourceVersion(value=RELEASE_8) public class AnnotationStatistics extends SourceChecker
javac -proc:only -processor org.checkerframework.common.util.count.AnnotationStatistics MyFile.java ...
You probably want to pipe the output through another program:
... | wc
.
... | sort | uniq -c
grep
By default, this utility displays annotation locations only. The following two options may be used to adjust the output:
-Aannotations
: prints information about the annotations
-Anolocations
: suppresses location output; only makes sense in conjunction with
-Aannotations
JavaCodeStatistics
SourceChecker.CheckerError
currentRoot, DETAILS_SEPARATOR, elementsWithSuppressedWarnings, errsOnLastExit, messager, messages, MSGS_FILE, parentChecker, SUPPRESS_ALL_KEY, trees, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, visitor
processingEnv
Constructor and Description |
---|
AnnotationStatistics() |
Modifier and Type | Method and Description |
---|---|
protected SourceVisitor<?,?> |
createSourceVisitor()
Provides the
SourceVisitor that the checker should use to scan input source trees. |
AnnotationProvider |
getAnnotationProvider() |
protected void |
incrementCount(Name annoName)
Increment the number of times annotation with name
annoName has appeared. |
void |
typeProcessingOver()
A method to be called once all the classes are processed and no error is reported.
|
addOptions, createSupportedLintOptions, errorAbort, errorAbort, expandCFOptions, formatStackTrace, fullMessageOf, getBooleanOption, getBooleanOption, getChecker, getContext, getElementUtils, getLintOption, getLintOption, getMessages, getOption, getOption, getOptionConfiguration, getOptions, getProcessingEnvironment, getProperties, getStandardSuppressWarningsKeys, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKeys, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, hasOption, init, initChecker, message, printMessage, printStats, processArg, report, setLintOption, setParentChecker, setProcessingEnvironment, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, treeToFilePositionString, typeProcess, typeProcessingStart, userErrorAbort, useUncheckedCodeDefault, warnUnneededSuppressions, warnUnneedSuppressions
process
getCompletions, isInitialized
public void typeProcessingOver()
AbstractTypeProcessor
Subclasses may override this method to do any aggregate analysis (e.g. generate report, persistence) or resource deallocation.
If an error (a Java error or a processor error) is reported, this method is not guaranteed to be invoked.
typeProcessingOver
in class AbstractTypeProcessor
protected void incrementCount(Name annoName)
annoName
has appeared.protected SourceVisitor<?,?> createSourceVisitor()
SourceChecker
SourceVisitor
that the checker should use to scan input source trees.createSourceVisitor
in class SourceChecker
SourceVisitor
to use to scan source treespublic AnnotationProvider getAnnotationProvider()
getAnnotationProvider
in interface BaseContext
getAnnotationProvider
in class SourceChecker