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
Modifier and TypeClassDescriptionstatic class
Stores the result of a can-be-static query. -
Method Summary
Modifier and TypeMethodDescriptioncanBeStaticResult
(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, visitAnyPattern, visitApply, visitAssert, visitAssign, visitAssignop, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClassDef, visitConditional, visitConstantCaseLabel, visitContinue, visitDefaultCaseLabel, visitDoLoop, visitErroneous, visitExec, visitExports, visitForeachLoop, visitForLoop, visitIf, visitImport, visitIndexed, visitLabelled, visitLambda, visitLetExpr, visitLiteral, visitMethodDef, visitModifiers, visitModuleDef, visitModuleImport, visitNewArray, visitOpens, visitPackageDef, visitParens, visitPatternCaseLabel, visitProvides, visitRecordPattern, 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
-
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 classcom.sun.tools.javac.tree.TreeScanner
-
visitSelect
public void visitSelect(com.sun.tools.javac.tree.JCTree.JCFieldAccess tree) - Overrides:
visitSelect
in classcom.sun.tools.javac.tree.TreeScanner
-
visitNewClass
public void visitNewClass(com.sun.tools.javac.tree.JCTree.JCNewClass tree) - Overrides:
visitNewClass
in classcom.sun.tools.javac.tree.TreeScanner
-
visitReference
public void visitReference(com.sun.tools.javac.tree.JCTree.JCMemberReference tree) - Overrides:
visitReference
in classcom.sun.tools.javac.tree.TreeScanner
-
visitAnnotation
public void visitAnnotation(com.sun.tools.javac.tree.JCTree.JCAnnotation tree) - Overrides:
visitAnnotation
in classcom.sun.tools.javac.tree.TreeScanner
-