Class AccessPath
java.lang.Object
com.google.errorprone.dataflow.AccessPath
A sequence of field names or autovalue accessors, along with a receiver: either a variable or a
reference (explicit or implicit) to
this. Fields and autovalue accessors are stored as
strings, with a "()" appended to accessor names to distinguish them from fields of the same name
For example:
x.f.g, the g field of the f field of the local variable x is
represented by {base = Some x, fields = "g" :: "f" :: nil}
foo.bar, the bar field of the foo field of the implicit this
is represented by {base = None, fields = "bar" :: "foo" :: nil}
x.foo().foo, the foo field of the foo() autovalue accessor of the
local variable x is represented by {base = Some x, fields = "foo" :: "foo()" :: nil}
- Author:
- bennostein@google.com (Benno Stein)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable Elementbase()If present, base of access path is contained Element; if absent, base is `this`static @Nullable AccessPathfromFieldAccess(org.checkerframework.errorprone.dataflow.cfg.node.FieldAccessNode fieldAccess) Creates an AccessPath from field reads / AutoValue accessor we can track and returns null otherwise (for example, when the receiver of the field access contains an array access or non-AutoValue method call.static AccessPathfromLocalVariable(org.checkerframework.errorprone.dataflow.cfg.node.LocalVariableNode node) static @Nullable AccessPathfromNodeIfTrackable(org.checkerframework.errorprone.dataflow.cfg.node.Node node) Returns an AccessPath representingnodeifnodeis representable as an access path and null otherwisestatic AccessPathfromVariableDecl(org.checkerframework.errorprone.dataflow.cfg.node.VariableDeclarationNode node) static booleanisAutoValueAccessor(Tree tree) Check whethertreeis an AutoValue accessor.abstract com.google.common.collect.ImmutableList<String> path()
-
Constructor Details
-
AccessPath
public AccessPath()
-
-
Method Details
-
base
If present, base of access path is contained Element; if absent, base is `this` -
path
-
isAutoValueAccessor
Check whethertreeis an AutoValue accessor. A tree is an AutoValue accessor iff:- it is a method invocation
- of an abstract method
- with 0 arguments
- defined on a class annotated @AutoValue
Public visibility for use in NullnessPropagationTransfer#returnValueNullness
-
fromFieldAccess
public static @Nullable AccessPath fromFieldAccess(org.checkerframework.errorprone.dataflow.cfg.node.FieldAccessNode fieldAccess) Creates an AccessPath from field reads / AutoValue accessor we can track and returns null otherwise (for example, when the receiver of the field access contains an array access or non-AutoValue method call. -
fromLocalVariable
public static AccessPath fromLocalVariable(org.checkerframework.errorprone.dataflow.cfg.node.LocalVariableNode node) -
fromVariableDecl
public static AccessPath fromVariableDecl(org.checkerframework.errorprone.dataflow.cfg.node.VariableDeclarationNode node) -
fromNodeIfTrackable
public static @Nullable AccessPath fromNodeIfTrackable(org.checkerframework.errorprone.dataflow.cfg.node.Node node) Returns an AccessPath representingnodeifnodeis representable as an access path and null otherwise
-