Class AggregateChecker
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.checkerframework.javacutil.AbstractTypeProcessor
org.checkerframework.framework.source.SourceChecker
org.checkerframework.framework.source.AggregateChecker
- All Implemented Interfaces:
Processor
,OptionConfiguration
- Direct Known Subclasses:
I18nChecker
An aggregate checker that packages multiple checkers together. The resulting checker invokes the
component checkers in turn on the processed files.
There is no communication, interaction, or cooperation between the component checkers, even to the extent of being able to read one another's qualifiers. An aggregate checker is merely shorthand to invoke a sequence of checkers.
This class delegates AbstractTypeProcessor
responsibilities to each component checker.
Checker writers need to subclass this class and only override getSupportedCheckers()
to indicate the classes of the checkers to be bundled.
-
Field Summary
Fields inherited from class org.checkerframework.framework.source.SourceChecker
currentRoot, DETAILS_SEPARATOR, elements, elementsWithSuppressedWarnings, errsOnLastExit, javacErrored, messager, messagesProperties, MSGS_FILE, OPTION_SEPARATOR, parentChecker, SUPPRESS_ALL_MESSAGE_KEY, SUPPRESS_ALL_PREFIX, trees, types, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, useAllcheckersPrefix, visitor
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SourceVisitor<?,
?> Provides theSourceVisitor
that the checker should use to scan input source trees.Return all active options for this checker.protected abstract Collection<Class<? extends SourceChecker>>
Returns the list of supported checkers to be run together.Returns the lint options recognized by this checker.Map the Checker Framework version ofSupportedOptions
to the standard annotation provided versionSupportedOptions
.void
Initialize the checker.protected void
processingEnv
needs to be set on each checker since we are not calling init on the checker, which leaves it null.final void
typeProcess
(TypeElement element, TreePath tree) Type-check the code using this checker's visitor.void
A method to be called once all the classes are processed.Methods inherited from class org.checkerframework.framework.source.SourceChecker
addOptions, createSupportedLintOptions, expandCFOptions, fullMessageOf, getAnnotationProvider, getBooleanOption, getBooleanOption, getElementUtils, getLintOption, getLintOption, getMessagesProperties, getOption, getOption, getOptionConfiguration, getParentChecker, getPathToCompilationUnit, getProcessingEnvironment, getProperties, getStandardSuppressWarningsPrefixes, getStringsOption, getStringsOption, getSupportedAnnotationTypes, getSupportedSourceVersion, getSuppressWarningsPrefixes, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, hasOption, init, message, message, messageKeyMatches, printOrStoreMessage, printOrStoreMessage, printStats, processErrorMessageArg, report, reportError, reportWarning, setLintOption, setParentChecker, setRoot, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipFiles, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, typeProcessingStart, useConservativeDefault, warnUnneededSuppressions, warnUnneededSuppressions
Methods inherited from class org.checkerframework.javacutil.AbstractTypeProcessor
getCompilerLog, process
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.checkerframework.framework.util.OptionConfiguration
getStringsOption, getStringsOption
-
Field Details
-
checkers
-
-
Constructor Details
-
AggregateChecker
protected AggregateChecker()Create a new AggregateChecker.
-
-
Method Details
-
getSupportedCheckers
Returns the list of supported checkers to be run together. Subclasses need to override this method.- Returns:
- the list of checkers to be run
-
setProcessingEnvironment
processingEnv
needs to be set on each checker since we are not calling init on the checker, which leaves it null. If one of checkers is an AggregateChecker, its visitors will try use checker's processing env which should not be null.- Overrides:
setProcessingEnvironment
in classSourceChecker
- Parameters:
env
- the new processing environment
-
initChecker
public void initChecker()Description copied from class:SourceChecker
Initialize the checker.- Overrides:
initChecker
in classSourceChecker
- See Also:
-
typeProcess
Description copied from class:SourceChecker
Type-check the code using this checker's visitor.- Overrides:
typeProcess
in classSourceChecker
- Parameters:
element
- element of the analyzed classtree
- the tree path to the element, with the leaf being aClassTree
- See Also:
-
typeProcessingOver
public void typeProcessingOver()Description copied from class:AbstractTypeProcessor
A method to be called once all the classes are processed.Subclasses 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.- Overrides:
typeProcessingOver
in classAbstractTypeProcessor
-
getSupportedOptions
Description copied from interface:OptionConfiguration
Map the Checker Framework version ofSupportedOptions
to the standard annotation provided versionSupportedOptions
.- Specified by:
getSupportedOptions
in interfaceOptionConfiguration
- Specified by:
getSupportedOptions
in interfaceProcessor
- Overrides:
getSupportedOptions
in classSourceChecker
- Returns:
- the supported options
-
getOptions
Description copied from interface:OptionConfiguration
Return all active options for this checker.- Specified by:
getOptions
in interfaceOptionConfiguration
- Overrides:
getOptions
in classSourceChecker
- Returns:
- all active options for this checker
-
getSupportedLintOptions
Description copied from class:SourceChecker
Returns the lint options recognized by this checker. Lint options are those which can be checked for viaSourceChecker.getLintOption(java.lang.String)
.- Overrides:
getSupportedLintOptions
in classSourceChecker
- Returns:
- an unmodifiable
Set
of the lint options recognized by this checker
-
createSourceVisitor
Description copied from class:SourceChecker
Provides theSourceVisitor
that the checker should use to scan input source trees.- Specified by:
createSourceVisitor
in classSourceChecker
- Returns:
- a
SourceVisitor
to use to scan source trees
-