@SupportedOptions(value={"nolocations","annotations","annotationsummaryonly"}) @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
-Aannotationsummaryonly: with both of the obove, only outputs a summary
JavaCodeStatisticscurrentRoot, DETAILS_SEPARATOR, elementsWithSuppressedWarnings, errsOnLastExit, javacErrored, messager, messagesProperties, MSGS_FILE, OPTION_SEPARATOR, parentChecker, SUPPRESS_ALL_MESSAGE_KEY, SUPPRESS_ALL_PREFIX, trees, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, useAllcheckersPrefix, visitorprocessingEnv| Constructor and Description |
|---|
AnnotationStatistics()
Creates an 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()
Returns the AnnotationProvider (the type factory) associated with this.
|
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.
|
addOptions, createSupportedLintOptions, expandCFOptions, fullMessageOf, getBooleanOption, getBooleanOption, getElementUtils, getLintOption, getLintOption, getMessagesProperties, getOption, getOption, getOptionConfiguration, getOptions, getParentChecker, getPathToCompilationUnit, getProcessingEnvironment, getProperties, getStandardSuppressWarningsPrefixes, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsPrefixes, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, hasOption, init, initChecker, message, message, printOrStoreMessage, printOrStoreMessage, printStats, processArg, report, reportError, reportJavacError, reportWarning, setLintOption, setParentChecker, setProcessingEnvironment, setRoot, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, typeProcess, typeProcessingStart, useConservativeDefault, warnUnneededSuppressions, warnUnneededSuppressionsgetCompilerLog, processgetCompletions, isInitializedpublic AnnotationStatistics()
public void typeProcessingOver()
AbstractTypeProcessorSubclasses may override this method to do any aggregate analysis (e.g. generate report, persistence) or resource deallocation.
Method AbstractTypeProcessor.getCompilerLog() can be used to access the number of compiler errors.
typeProcessingOver in class AbstractTypeProcessorprotected void incrementCount(Name annoName)
annoName has appeared.protected SourceVisitor<?,?> createSourceVisitor()
SourceCheckerSourceVisitor that the checker should use to scan input source trees.createSourceVisitor in class SourceCheckerSourceVisitor to use to scan source treespublic AnnotationProvider getAnnotationProvider()
SourceCheckergetAnnotationProvider in class SourceChecker