public abstract class Receiver extends Object
?:
; use
Unknown
for unrepresentable expressions).
This class's representation is like an AST: subparts are also expressions. For declared names (fields, local variables, and methods), it also contains an Element.
Each subclass represents a different type of expression, such as MethodCall
, ArrayAccess
, LocalVariable
, etc.
Modifier and Type | Field and Description |
---|---|
protected TypeMirror |
type
The type of this expression.
|
Modifier | Constructor and Description |
---|---|
protected |
Receiver(TypeMirror type)
Create a Receiver (a Java AST node representing an expression).
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsModifiableAliasOf(Store<?> store,
Receiver other)
Returns true if and only if
other appears anywhere in this receiver or an expression
appears in this receiver such that other might alias this expression, and that
expression is modifiable. |
abstract boolean |
containsOfClass(Class<? extends Receiver> clazz) |
boolean |
containsSyntacticEqualReceiver(Receiver other)
Returns true if and only if this receiver contains a receiver that is syntactically equal to
other . |
boolean |
containsUnknown() |
TypeMirror |
getType() |
abstract boolean |
isUnassignableByOtherCode()
Returns true if and only if the value this expression stands for cannot be changed (with
respect to ==) by a method call.
|
abstract boolean |
isUnmodifiableByOtherCode()
Returns true if and only if the value this expression stands for cannot be changed by a
method call, including changes to any of its fields.
|
boolean |
syntacticEquals(Receiver other)
Returns true if and only if the two receivers are syntactically identical.
|
String |
toStringDebug()
Print this verbosely, for debugging.
|
protected final TypeMirror type
protected Receiver(TypeMirror type)
type
- the type of the expressionpublic TypeMirror getType()
public boolean containsUnknown()
public abstract boolean isUnassignableByOtherCode()
isUnassignableByOtherCode()
, and binary
operations whose left and right operands are both isUnmodifiableByOtherCode()
.isUnmodifiableByOtherCode()
public abstract boolean isUnmodifiableByOtherCode()
Approximately, this returns true if the expression is isUnassignableByOtherCode()
and its type is immutable.
isUnassignableByOtherCode()
@EqualsMethod public boolean syntacticEquals(Receiver other)
other
- the other object to compare to this onepublic boolean containsSyntacticEqualReceiver(Receiver other)
other
.other
public boolean containsModifiableAliasOf(Store<?> store, Receiver other)
other
appears anywhere in this receiver or an expression
appears in this receiver such that other
might 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'.
public String toStringDebug()