Class CanBeStaticAnalyzer

java.lang.Object
com.sun.tools.javac.tree.JCTree.Visitor
com.sun.tools.javac.tree.TreeScanner
com.google.errorprone.bugpatterns.CanBeStaticAnalyzer

public class CanBeStaticAnalyzer
extends com.sun.tools.javac.tree.TreeScanner
Analyzes trees for references to their enclosing instance.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  CanBeStaticAnalyzer.CanBeStaticResult
    Stores the result of a can-be-static query.
  • Method Summary

    Modifier and Type Method Description
    static CanBeStaticAnalyzer.CanBeStaticResult canBeStaticResult​(com.sun.source.tree.Tree tree, com.sun.tools.javac.code.Symbol owner, VisitorState state)  
    static boolean referencesOuter​(com.sun.source.tree.Tree tree, com.sun.tools.javac.code.Symbol owner, VisitorState state)
    Returns true if the tree references its enclosing class.
    void visitAnnotation​(com.sun.tools.javac.tree.JCTree.JCAnnotation tree)  
    void visitIdent​(com.sun.tools.javac.tree.JCTree.JCIdent tree)  
    void visitNewClass​(com.sun.tools.javac.tree.JCTree.JCNewClass tree)  
    void visitReference​(com.sun.tools.javac.tree.JCTree.JCMemberReference tree)  
    void visitSelect​(com.sun.tools.javac.tree.JCTree.JCFieldAccess tree)  

    Methods inherited from class com.sun.tools.javac.tree.TreeScanner

    scan, scan, visitAnnotatedType, visitApply, visitAssert, visitAssign, visitAssignop, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClassDef, visitConditional, visitContinue, visitDoLoop, visitErroneous, visitExec, visitExports, visitForeachLoop, visitForLoop, visitIf, visitImport, visitIndexed, visitLabelled, visitLambda, visitLetExpr, visitLiteral, visitMethodDef, visitModifiers, visitModuleDef, visitNewArray, visitOpens, visitPackageDef, visitParens, visitProvides, visitRequires, visitReturn, visitSkip, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTopLevel, visitTree, visitTry, visitTypeApply, visitTypeArray, visitTypeBoundKind, visitTypeCast, visitTypeIdent, visitTypeIntersection, visitTypeParameter, visitTypeTest, visitTypeUnion, visitUnary, visitUses, visitVarDef, visitWhileLoop, visitWildcard, visitYield

    Methods inherited from class java.lang.Object

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

    • referencesOuter

      public static boolean referencesOuter​(com.sun.source.tree.Tree tree, com.sun.tools.javac.code.Symbol owner, VisitorState state)
      Returns true if the tree references its enclosing class.
    • canBeStaticResult

      public static CanBeStaticAnalyzer.CanBeStaticResult canBeStaticResult​(com.sun.source.tree.Tree tree, com.sun.tools.javac.code.Symbol owner, VisitorState state)
    • visitIdent

      public void visitIdent​(com.sun.tools.javac.tree.JCTree.JCIdent tree)
      Overrides:
      visitIdent in class com.sun.tools.javac.tree.TreeScanner
    • visitSelect

      public void visitSelect​(com.sun.tools.javac.tree.JCTree.JCFieldAccess tree)
      Overrides:
      visitSelect in class com.sun.tools.javac.tree.TreeScanner
    • visitNewClass

      public void visitNewClass​(com.sun.tools.javac.tree.JCTree.JCNewClass tree)
      Overrides:
      visitNewClass in class com.sun.tools.javac.tree.TreeScanner
    • visitReference

      public void visitReference​(com.sun.tools.javac.tree.JCTree.JCMemberReference tree)
      Overrides:
      visitReference in class com.sun.tools.javac.tree.TreeScanner
    • visitAnnotation

      public void visitAnnotation​(com.sun.tools.javac.tree.JCTree.JCAnnotation tree)
      Overrides:
      visitAnnotation in class com.sun.tools.javac.tree.TreeScanner