Class Scanner

java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<Void,VisitorState>
com.google.errorprone.scanner.Scanner
All Implemented Interfaces:
com.sun.source.tree.TreeVisitor<Void,VisitorState>
Direct Known Subclasses:
ErrorProneScanner

@CheckReturnValue public class Scanner extends com.sun.source.util.TreePathScanner<Void,VisitorState>
TODO(eaftan): I'm worried about this performance of this code, specifically the part that handles SuppressWarnings. We should profile it and see where the hotspots are.
Author:
alexeagle@google.com (Alex Eagle), eaftan@google.com (Eddie Aftandilian)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Set<? extends com.sun.tools.javac.util.Name>
    Returns a set of all the custom suppression annotation types used by the BugCheckers in thisScanner.
    protected void
    Handles an exception thrown by an individual check.
    isSuppressed(Suppressible suppressible, ErrorProneOptions errorProneOptions, VisitorState state)
    Returns if this checker should be suppressed on the current tree path.
    protected void
    reportMatch(Description description, VisitorState state)
     
    scan(com.sun.source.tree.Tree tree, VisitorState state)
    Scan a single node.
    scan(com.sun.source.util.TreePath path, VisitorState state)
    Scan a tree from a position identified by a TreePath.
    Returns a mapping between the canonical names of checks and their BugPattern.SeverityLevel.

    Methods inherited from class com.sun.source.util.TreePathScanner

    getCurrentPath

    Methods inherited from class com.sun.source.util.TreeScanner

    reduce, scan, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitGuardedPattern, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitParenthesizedPattern, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard, visitYield

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Scanner

      public Scanner()
  • Method Details

    • scan

      public Void scan(com.sun.source.util.TreePath path, VisitorState state)
      Scan a tree from a position identified by a TreePath.
      Overrides:
      scan in class com.sun.source.util.TreePathScanner<Void,VisitorState>
    • scan

      public Void scan(com.sun.source.tree.Tree tree, VisitorState state)
      Scan a single node. The current path is updated for the duration of the scan.
      Overrides:
      scan in class com.sun.source.util.TreePathScanner<Void,VisitorState>
    • isSuppressed

      protected SuppressionInfo.SuppressedState isSuppressed(Suppressible suppressible, ErrorProneOptions errorProneOptions, VisitorState state)
      Returns if this checker should be suppressed on the current tree path.
      Parameters:
      suppressible - holds information about the suppressibility of a checker
      errorProneOptions - Options object configuring whether or not to suppress non-errors in
    • getCustomSuppressionAnnotations

      protected Set<? extends com.sun.tools.javac.util.Name> getCustomSuppressionAnnotations(VisitorState state)
      Returns a set of all the custom suppression annotation types used by the BugCheckers in thisScanner.
    • reportMatch

      protected void reportMatch(Description description, VisitorState state)
    • handleError

      protected void handleError(Suppressible s, Throwable t)
      Handles an exception thrown by an individual check.
    • severityMap

      public Map<String,BugPattern.SeverityLevel> severityMap()
      Returns a mapping between the canonical names of checks and their BugPattern.SeverityLevel.