Class AggregateChecker

  • All Implemented Interfaces:
    javax.annotation.processing.Processor, OptionConfiguration
    Direct Known Subclasses:
    I18nChecker

    public abstract class AggregateChecker
    extends SourceChecker
    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 Detail

      • checkers

        protected final java.util.List<SourceChecker> checkers
    • Constructor Detail

      • AggregateChecker

        protected AggregateChecker()
        Create a new AggregateChecker.
    • Method Detail

      • getSupportedCheckers

        protected abstract java.util.Collection<java.lang.Class<? extends SourceChecker>> 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

        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. If one of checkers is an AggregateChecker, its visitors will try use checker's processing env which should not be null.
        Overrides:
        setProcessingEnvironment in class SourceChecker
        Parameters:
        env - the new processing environment
      • initChecker

        public void initChecker()
        Description copied from class: SourceChecker
        Initialize the checker.
        Overrides:
        initChecker in class SourceChecker
        See Also:
        AbstractProcessor.init(ProcessingEnvironment)
      • typeProcess

        public final void typeProcess​(javax.lang.model.element.TypeElement element,
                                      com.sun.source.util.TreePath tree)
        Description copied from class: SourceChecker
        Type-check the code using this checker's visitor.
        Overrides:
        typeProcess in class SourceChecker
        Parameters:
        element - element of the analyzed class
        tree - the tree path to the element, with the leaf being a ClassTree
        See Also:
        Processor.process(Set, RoundEnvironment)
      • getSupportedOptions

        public final java.util.Set<java.lang.String> getSupportedOptions()
        Description copied from class: SourceChecker
        Map the Checker Framework version of SupportedOptions to the standard annotation provided version SupportedOptions.
        Specified by:
        getSupportedOptions in interface OptionConfiguration
        Specified by:
        getSupportedOptions in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedOptions in class SourceChecker
        Returns:
        the supported options