Class DataFlow::InstanceAccessExt

A generalization of InstanceAccess that includes implicit accesses.

The accesses can be divided into 6 kinds:

  • Explicit: Represented by an InstanceAccess.
  • Implicit field qualifier: The implicit access associated with an unqualified FieldAccess to a non-static field.
  • Implicit method qualifier: The implicit access associated with an unqualified MethodAccess to a non-static method.
  • Implicit this constructor argument: The implicit argument of the value of this to a constructor call of the form this() or super().
  • Implicit enclosing instance capture: The implicit capture of the value of the directly enclosing instance of a constructed inner class. This is associated with an unqualified constructor call.
  • Implicit enclosing instance qualifier: The instance access that occurs as the implicit qualifier of a desugared enclosing instance access.

Of these 6 kinds, the fourth (implicit this constructor argument) is always an OwnInstanceAccess, whereas the other 5 can be either OwnInstanceAccess or EnclosingInstanceAccess.

Import path

import semmle.code.java.dataflow.DataFlow

Direct supertypes

Known direct subtypes

Predicates

getCfgNode

Gets the control flow node associated with this instance access.

getEnclosingCallable

Gets the callable in which this instance access occurs.

getLocation

Gets the source location for this element.

getType

Gets the type of this instance access.

isEnclosingInstanceAccess

Holds if this is an access to an enclosing instance.

isExplicit

Holds if this is the explicit instance access ia.

isImplicitEnclosingInstanceCapture

Holds if this is the implicit qualifier of cc.

isImplicitEnclosingInstanceQualifier

Holds if this is the implicit qualifier of the desugared enclosing instance access enc.

isImplicitFieldQualifier

Holds if this is the implicit qualifier of fa.

isImplicitMethodQualifier

Holds if this is the implicit qualifier of ma.

isImplicitThisConstructorArgument

Holds if this is the implicit this argument of cc, which is either a ThisConstructorInvocationStmt or a SuperConstructorInvocationStmt.

isOwnInstanceAccess

Holds if this is an access to an object’s own instance.

toString

Gets a textual representation of this element.