Class FieldAccess
SomeClass.class or int[].class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VariableElementThe field being accessed.protected final JavaExpressionThe receiver of the field access.Fields inherited from class org.checkerframework.dataflow.expression.JavaExpression
type -
Constructor Summary
ConstructorsConstructorDescriptionFieldAccess(JavaExpression receiver, VariableElement fieldElement) Create aFieldAccess.FieldAccess(JavaExpression receiver, TypeMirror type, VariableElement fieldElement) Create aFieldAccess.FieldAccess(JavaExpression receiver, FieldAccessNode node) Create aFieldAccess. -
Method Summary
Modifier and TypeMethodDescription<R,P> R accept(JavaExpressionVisitor<R, P> visitor, P p) Accept method of the visitor pattern.<T extends JavaExpression>
@Nullable TcontainedOfClass(Class<T> clazz) Returns the first subexpression whose class is the given class, or null.booleancontainsModifiableAliasOf(Store<?> store, JavaExpression other) Returns true if and only ifotherappears anywhere in this or an expression appears in this such thatothermight alias this expression, and that expression is modifiable.booleanReturns true if and only if this contains a JavaExpression that is syntactically equal toother.booleangetField()Returns the field.Returns the receiver.inthashCode()booleanReturns true if some subexpression of this can be assigned to from outside the current method body.booleanisDeterministic(AnnotationProvider provider) Returns true if the expression is deterministic.booleanisFinal()booleanReturns true if the value this expression stands for can be changed by a method call; equivalently, if the value this expression evaluates to can be changed by a side effect from outside the containing method.booleanisStatic()booleanReturns true if and only if the two Java expressions are syntactically identical.toString()Format this verbosely, for debugging.Methods inherited from class org.checkerframework.dataflow.expression.JavaExpression
atConstructorInvocation, atFieldAccess, atMethodBody, atMethodInvocation, atMethodInvocation, containedUnknown, containsOfClass, containsUnknown, fromArrayAccess, fromNode, fromNodeFieldAccess, fromTree, fromVariableTree, getFormalParameters, getImplicitReceiver, getParametersAsLocalVariables, getPseudoReceiver, getReceiver, getType, isUnassignableByOtherCode, isUnmodifiableByOtherCode, listContainsSyntacticEqualJavaExpression, listIsDeterministic, syntacticEqualsList
-
Field Details
-
receiver
The receiver of the field access. -
field
The field being accessed.
-
-
Constructor Details
-
FieldAccess
Create aFieldAccess.- Parameters:
receiver- receiver of the field accessnode- the FieldAccessNode
-
FieldAccess
Create aFieldAccess.- Parameters:
receiver- receiver of the field accessfieldElement- element of the field
-
FieldAccess
Create aFieldAccess.- Parameters:
receiver- receiver of the field accesstype- type of the fieldfieldElement- element of the field
-
-
Method Details
-
getReceiver
Returns the receiver.- Returns:
- the receiver
-
getField
Returns the field.- Returns:
- the field
-
isFinal
public boolean isFinal() -
isStatic
public boolean isStatic() -
equals
-
hashCode
public int hashCode() -
syntacticEquals
Description copied from class:JavaExpressionReturns true if and only if the two Java expressions are syntactically identical.This exists for use by
JavaExpression.containsSyntacticEqualJavaExpression(org.checkerframework.dataflow.expression.JavaExpression).- Specified by:
syntacticEqualsin classJavaExpression- Parameters:
je- the other Java expression to compare to this one- Returns:
- true if and only if the two Java expressions are syntactically identical
-
containsSyntacticEqualJavaExpression
Description copied from class:JavaExpressionReturns true if and only if this contains a JavaExpression that is syntactically equal toother.- Specified by:
containsSyntacticEqualJavaExpressionin classJavaExpression- Parameters:
other- the JavaExpression to search for- Returns:
- true if and only if this contains a JavaExpression that is syntactically equal to
other
-
containsModifiableAliasOf
Description copied from class:JavaExpressionReturns true if and only ifotherappears anywhere in this or an expression appears in this such thatothermight alias this expression, and that expression is modifiable.This is always true, except for cases where the Java type information prevents aliasing and none of the subexpressions can alias 'other'.
- Overrides:
containsModifiableAliasOfin classJavaExpression
-
toString
-
toStringDebug
Description copied from class:JavaExpressionFormat this verbosely, for debugging.- Overrides:
toStringDebugin classJavaExpression- Returns:
- a verbose string representation of this
-
containedOfClass
Description copied from class:JavaExpressionReturns the first subexpression whose class is the given class, or null.This is intended as a diagnostic aid; most clients will use
JavaExpression.containsOfClass(java.lang.Class<? extends org.checkerframework.dataflow.expression.JavaExpression>).- Specified by:
containedOfClassin classJavaExpression- Type Parameters:
T- the type corresponding toclazz- Parameters:
clazz- the JavaExpression subclass to search for- Returns:
- true if some subexpression whose class is the given class
-
isDeterministic
Description copied from class:JavaExpressionReturns true if the expression is deterministic.- Specified by:
isDeterministicin classJavaExpression- Parameters:
provider- an annotation provider (a type factory)- Returns:
- true if this expression is deterministic
-
isAssignableByOtherCode
public boolean isAssignableByOtherCode()Description copied from class:JavaExpressionReturns true if some subexpression of this can be assigned to from outside the current method body.This is false for local variables, the self reference, final field accesses whose receiver is
JavaExpression.isUnassignableByOtherCode(), and operations whose operands are all notJavaExpression.isModifiableByOtherCode().- Overrides:
isAssignableByOtherCodein classJavaExpression- Returns:
- true if some subexpression of this can be assigned to from outside the current method body
- See Also:
-
isModifiableByOtherCode
public boolean isModifiableByOtherCode()Description copied from class:JavaExpressionReturns true if the value this expression stands for can be changed by a method call; equivalently, if the value this expression evaluates to can be changed by a side effect from outside the containing method.Approximately, this returns true if the expression is
JavaExpression.isAssignableByOtherCode()or its type is mutable. (Stringis an immutable type.)- Overrides:
isModifiableByOtherCodein classJavaExpression- Returns:
- true if the value of this expression can be changed from outside the current method body
- See Also:
-
accept
Description copied from class:JavaExpressionAccept method of the visitor pattern.- Specified by:
acceptin classJavaExpression- Type Parameters:
R- result type of the operationP- parameter type- Parameters:
visitor- the visitor to be applied to this JavaExpressionp- the parameter for this operation- Returns:
- the result of visiting this
-