public abstract class AggregateChecker extends SourceChecker
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.
Modifier and Type | Field and Description |
---|---|
protected List<SourceChecker> |
checkers |
currentRoot, DETAILS_SEPARATOR, elementsWithSuppressedWarnings, errsOnLastExit, messager, messagesProperties, MSGS_FILE, OPTION_SEPARATOR, parentChecker, SUPPRESS_ALL_MESSAGE_KEY, SUPPRESS_ALL_PREFIX, trees, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, visitor
processingEnv
Modifier | Constructor and Description |
---|---|
protected |
AggregateChecker()
Create a new AggregateChecker.
|
Modifier and Type | Method and Description |
---|---|
protected SourceVisitor<?,?> |
createSourceVisitor()
Provides the
SourceVisitor that the checker should use to scan input source trees. |
Map<String,String> |
getOptions()
Return all active options for this checker.
|
protected abstract Collection<Class<? extends SourceChecker>> |
getSupportedCheckers()
Returns the list of supported checkers to be run together.
|
Set<String> |
getSupportedLintOptions()
Returns the lint options recognized by this checker.
|
Set<String> |
getSupportedOptions()
Map the Checker Framework version of
SupportedOptions to the standard annotation
provided version SupportedOptions . |
void |
initChecker()
Initialize the checker.
|
protected void |
setProcessingEnvironment(ProcessingEnvironment env)
processingEnv needs to be set on each checker since we are not calling init on the checker,
which leaves it null.
|
void |
typeProcess(TypeElement element,
TreePath tree)
Type-check the code using this checker's visitor.
|
void |
typeProcessingOver()
A method to be called once all the classes are processed and no error is reported.
|
addOptions, createSupportedLintOptions, expandCFOptions, fullMessageOf, getAnnotationProvider, getBooleanOption, getBooleanOption, getChecker, getContext, getElementUtils, getLintOption, getLintOption, getMessagesProperties, getOption, getOption, getOptionConfiguration, getParentChecker, getProcessingEnvironment, getProperties, getStandardSuppressWarningsPrefixes, getSupportedAnnotationTypes, getSupportedSourceVersion, getSuppressWarningsPrefixes, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, hasOption, init, message, printOrStoreMessage, printOrStoreMessage, printStats, processArg, report, reportError, reportWarning, setLintOption, setParentChecker, setRoot, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, typeProcessingStart, useConservativeDefault, warnUnneededSuppressions, warnUnneededSuppressions
getCompilerLog, process
getCompletions, isInitialized
protected final List<SourceChecker> checkers
protected abstract Collection<Class<? extends SourceChecker>> getSupportedCheckers()
protected void setProcessingEnvironment(ProcessingEnvironment env)
setProcessingEnvironment
in class SourceChecker
public void initChecker()
SourceChecker
initChecker
in class SourceChecker
AbstractProcessor.init(ProcessingEnvironment)
public final void typeProcess(TypeElement element, TreePath tree)
SourceChecker
typeProcess
in class SourceChecker
element
- element of the analyzed classtree
- the tree path to the element, with the leaf being a ClassTree
Processor.process(Set, RoundEnvironment)
public void typeProcessingOver()
AbstractTypeProcessor
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.
typeProcessingOver
in class AbstractTypeProcessor
public final Set<String> getSupportedOptions()
SourceChecker
SupportedOptions
to the standard annotation
provided version SupportedOptions
.getSupportedOptions
in interface Processor
getSupportedOptions
in interface OptionConfiguration
getSupportedOptions
in class SourceChecker
public final Map<String,String> getOptions()
SourceChecker
getOptions
in interface OptionConfiguration
getOptions
in class SourceChecker
public final Set<String> getSupportedLintOptions()
SourceChecker
SourceChecker.getLintOption(java.lang.String)
.getSupportedLintOptions
in class SourceChecker
Set
of the lint options recognized by this checkerprotected SourceVisitor<?,?> createSourceVisitor()
SourceChecker
SourceVisitor
that the checker should use to scan input source trees.createSourceVisitor
in class SourceChecker
SourceVisitor
to use to scan source trees