Record Class AccessPath
java.lang.Object
java.lang.Record
com.google.errorprone.dataflow.AccessPath
- Record Components:
base- If present, base of access path is contained Element; if absent, base is `this`
public record AccessPath(@Nullable Element base, com.google.common.collect.ImmutableList<String> path)
extends Record
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
ConstructorsConstructorDescriptionAccessPath(@Nullable Element base, com.google.common.collect.ImmutableList<String> path) Creates an instance of aAccessPathrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable Elementbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.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) final inthashCode()Returns a hash code value for this object.static booleanisAutoValueAccessor(Tree tree) Check whethertreeis an AutoValue accessor.com.google.common.collect.ImmutableList<String> path()Returns the value of thepathrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AccessPath
-
-
Method Details
-
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 -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
base
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-