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, messages, MSGS_FILE, parentChecker, SUPPRESS_ALL_KEY, trees, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, visitor
processingEnv
Constructor and Description |
---|
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 with Java specifications and then runs the Checker Rule Checking visitor
on the processed source.
|
void |
typeProcessingOver()
A method to be called once all the classes are processed and no error is reported.
|
addOptions, createSupportedLintOptions, expandCFOptions, formatStackTrace, fullMessageOf, getAnnotationProvider, getBooleanOption, getBooleanOption, getChecker, getContext, getElementUtils, getLintOption, getLintOption, getMessages, getOption, getOption, getOptionConfiguration, getProcessingEnvironment, getProperties, getStandardSuppressWarningsKeys, getSupportedAnnotationTypes, getSupportedSourceVersion, getSuppressWarningsKeys, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getVisitor, hasOption, init, message, printMessage, printStats, processArg, report, setLintOption, setParentChecker, setRoot, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, treeToFilePositionString, typeProcessingStart, useUncheckedCodeDefault, warnUnneededSuppressions, warnUnneedSuppressions
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.
If an error (a Java error or a processor error) is reported, this method is not guaranteed to be invoked.
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