Class SourceVisitor<R,P>

java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
org.checkerframework.framework.source.SourceVisitor<R,P>
All Implemented Interfaces:
TreeVisitor<R,P>
Direct Known Subclasses:
BaseTypeVisitor, ModifiabilityVisitor

public abstract class SourceVisitor<R,P> extends TreePathScanner<R,P>
An AST visitor that provides a variety of compiler utilities and interfaces to facilitate type-checking.
  • Field Details

  • Constructor Details

    • SourceVisitor

      protected SourceVisitor(SourceChecker checker)
      Creates a SourceVisitor to use for scanning a source tree.
      Parameters:
      checker - the checker to invoke on the input source tree
  • Method Details

    • setRoot

      public void setRoot(CompilationUnitTree newRoot)
      Set the CompilationUnitTree to be used during any visits. For any later calls of com.sun.source.util.TreePathScanner.scan(TreePath, P), the CompilationUnitTree of the TreePath has to be equal to root.
      Parameters:
      newRoot - the new compilation unit
    • visit

      public void visit(TreePath path)
      Entry point for a type processor: the TreePath leaf is a top-level type tree within root.
    • scan

      public R scan(Tree tree, P p)
      Overrides:
      scan in class TreePathScanner<R,P>
    • visitClass

      public R visitClass(ClassTree classTree, P p)
      Specified by:
      visitClass in interface TreeVisitor<R,P>
      Overrides:
      visitClass in class TreeScanner<R,P>
    • visitVariable

      public R visitVariable(VariableTree variableTree, P p)
      Specified by:
      visitVariable in interface TreeVisitor<R,P>
      Overrides:
      visitVariable in class TreeScanner<R,P>
    • visitMethod

      public R visitMethod(MethodTree tree, P p)
      Specified by:
      visitMethod in interface TreeVisitor<R,P>
      Overrides:
      visitMethod in class TreeScanner<R,P>
    • storeSuppressWarningsAnno

      protected void storeSuppressWarningsAnno(Tree tree)
      If tree has a @SuppressWarnings add it to treesWithSuppressWarnings.
      Parameters:
      tree - a declaration on which a @SuppressWarnings annotation may be placed