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
FieldsFields 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, treePathCacher, trees, types, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, useAllcheckersPrefix, visitorFields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SourceVisitor<?, ?> Provides theSourceVisitorthat 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 ofSupportedOptionsto the standard annotation provided versionSupportedOptions.voidInitialize the checker.protected voidprocessingEnvneeds to be set on each checker since we are not calling init on the checker, which leaves it null.final voidtypeProcess(TypeElement element, TreePath tree) Type-check the code using this checker's visitor.voidA 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, getTreePathCacher, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, getWarningMessagePrefix, hasOption, init, message, message, messageKeyMatches, printOrStoreMessage, printOrStoreMessage, printStats, processErrorMessageArg, report, reportError, reportWarning, setLintOption, setParentChecker, setRoot, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, typeProcessingStart, useConservativeDefault, warnUnneededSuppressions, warnUnneededSuppressionsMethods inherited from class org.checkerframework.javacutil.AbstractTypeProcessor
getCompilerLog, processMethods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
processingEnvneeds 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:
setProcessingEnvironmentin classSourceChecker- Parameters:
env- the new processing environment
-
initChecker
public void initChecker()Description copied from class:SourceCheckerInitialize the checker.- Overrides:
initCheckerin classSourceChecker- See Also:
-
typeProcess
Description copied from class:SourceCheckerType-check the code using this checker's visitor.- Overrides:
typeProcessin 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:AbstractTypeProcessorA 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:
typeProcessingOverin classAbstractTypeProcessor
-
getSupportedOptions
Description copied from class:SourceCheckerMap the Checker Framework version ofSupportedOptionsto the standard annotation provided versionSupportedOptions.- Specified by:
getSupportedOptionsin interfaceOptionConfiguration- Specified by:
getSupportedOptionsin interfaceProcessor- Overrides:
getSupportedOptionsin classSourceChecker- Returns:
- the supported options
-
getOptions
Description copied from interface:OptionConfigurationReturn all active options for this checker.- Specified by:
getOptionsin interfaceOptionConfiguration- Overrides:
getOptionsin classSourceChecker- Returns:
- all active options for this checker
-
getSupportedLintOptions
Description copied from class:SourceCheckerReturns the lint options recognized by this checker. Lint options are those which can be checked for viaSourceChecker.getLintOption(java.lang.String).- Overrides:
getSupportedLintOptionsin classSourceChecker- Returns:
- an unmodifiable
Setof the lint options recognized by this checker
-
createSourceVisitor
Description copied from class:SourceCheckerProvides theSourceVisitorthat the checker should use to scan input source trees.- Specified by:
createSourceVisitorin classSourceChecker- Returns:
- a
SourceVisitorto use to scan source trees
-