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.
SourceChecker.CheckerError
Modifier and Type | Field and Description |
---|---|
protected java.util.List<SourceChecker> |
checkers |
currentRoot, DETAILS_SEPARATOR, errsOnLastExit, messager, messages, MSGS_FILE, parentChecker, SUPPRESS_ALL_KEY, trees, upstreamCheckerNames, visitor
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. |
java.util.Map<java.lang.String,java.lang.String> |
getOptions()
Return all active options for this checker.
|
protected abstract java.util.Collection<java.lang.Class<? extends SourceChecker>> |
getSupportedCheckers()
Returns the list of supported checkers to be run together.
|
java.util.Set<java.lang.String> |
getSupportedLintOptions()
Returns the lint options recognized by this checker.
|
java.util.Set<java.lang.String> |
getSupportedOptions()
Map the Checker Framework version of
SupportedOptions to the standard annotation
provided version SupportedOptions . |
void |
initChecker()
Initialize the checker.
|
protected void |
setProcessingEnvironment(javax.annotation.processing.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(javax.lang.model.element.TypeElement element,
com.sun.source.util.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, errorAbort, errorAbort, expandCFOptions, formatStackTrace, fullMessageOf, getAnnotationProvider, 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, setSupportedLintOptions, shouldAddShutdownHook, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shutdownHook, treeToFilePositionString, typeProcessingStart, userErrorAbort, useUncheckedCodeDefault
process
protected final java.util.List<SourceChecker> checkers
protected abstract java.util.Collection<java.lang.Class<? extends SourceChecker>> getSupportedCheckers()
protected void setProcessingEnvironment(javax.annotation.processing.ProcessingEnvironment env)
setProcessingEnvironment
in class SourceChecker
public void initChecker()
SourceChecker
initChecker
in class SourceChecker
AbstractProcessor.init(ProcessingEnvironment)
public final void typeProcess(javax.lang.model.element.TypeElement element, com.sun.source.util.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 java.util.Set<java.lang.String> getSupportedOptions()
SourceChecker
SupportedOptions
to the standard annotation
provided version SupportedOptions
.getSupportedOptions
in interface javax.annotation.processing.Processor
getSupportedOptions
in interface OptionConfiguration
getSupportedOptions
in class SourceChecker
public final java.util.Map<java.lang.String,java.lang.String> getOptions()
SourceChecker
getOptions
in interface OptionConfiguration
getOptions
in class SourceChecker
public final java.util.Set<java.lang.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