public class ValueLiteral extends JavaExpression
Modifier and Type | Field and Description |
---|---|
protected @Nullable Object |
value
The value of the literal.
|
type
Constructor and Description |
---|
ValueLiteral(TypeMirror type,
Object value)
Creates a ValueLiteral where the value is
value that has the given type. |
ValueLiteral(TypeMirror type,
ValueLiteralNode node)
Creates a ValueLiteral from the node with the given type.
|
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(JavaExpressionVisitor<R,P> visitor,
P p)
Accept method of the visitor pattern.
|
boolean |
containsModifiableAliasOf(Store<?> store,
JavaExpression other)
Returns true if and only if
other appears anywhere in this or an expression appears
in this such that other might alias this expression, and that expression is
modifiable. |
boolean |
containsOfClass(Class<? extends JavaExpression> clazz) |
boolean |
containsSyntacticEqualJavaExpression(JavaExpression other)
Returns true if and only if this contains a JavaExpression that is syntactically equal to
other . |
boolean |
equals(@Nullable Object obj) |
@Nullable Object |
getValue()
Returns the value of this literal.
|
int |
hashCode() |
boolean |
isDeterministic(AnnotationProvider provider)
Returns true if the expression is deterministic.
|
boolean |
isUnassignableByOtherCode()
Returns true if and only if the value this expression stands for cannot be changed (with
respect to ==) by a method call.
|
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.
|
ValueLiteral |
negate()
Returns the negation of this literal.
|
boolean |
syntacticEquals(JavaExpression je)
Returns true if and only if the two Java expressions are syntactically identical.
|
String |
toString() |
containsUnknown, fromArrayAccess, fromNode, fromNodeFieldAccess, fromTree, fromVariableTree, getImplicitReceiver, getParametersOfEnclosingMethod, getPseudoReceiver, getReceiver, getType, listContainsSyntacticEqualJavaExpression, listIsDeterministic, toStringDebug
public ValueLiteral(TypeMirror type, ValueLiteralNode node)
type
- type of the literalnode
- the literal represents by this ValueLiteral
public ValueLiteral(TypeMirror type, Object value)
value
that has the given type.type
- type of the literalvalue
- the literal valuepublic ValueLiteral negate()
public @Nullable Object getValue()
public boolean containsOfClass(Class<? extends JavaExpression> clazz)
containsOfClass
in class JavaExpression
public boolean isDeterministic(AnnotationProvider provider)
JavaExpression
isDeterministic
in class JavaExpression
provider
- an annotation provider (a type factory)public boolean isUnassignableByOtherCode()
JavaExpression
JavaExpression.isUnassignableByOtherCode()
, and operations
whose operands are all JavaExpression.isUnmodifiableByOtherCode()
.isUnassignableByOtherCode
in class JavaExpression
JavaExpression.isUnmodifiableByOtherCode()
public boolean isUnmodifiableByOtherCode()
JavaExpression
Approximately, this returns true if the expression is JavaExpression.isUnassignableByOtherCode()
and its type is immutable.
isUnmodifiableByOtherCode
in class JavaExpression
JavaExpression.isUnassignableByOtherCode()
public boolean syntacticEquals(JavaExpression je)
JavaExpression
This exists for use by JavaExpression.containsSyntacticEqualJavaExpression(org.checkerframework.dataflow.expression.JavaExpression)
.
syntacticEquals
in class JavaExpression
je
- the other Java expression to compare to this onepublic boolean containsSyntacticEqualJavaExpression(JavaExpression other)
JavaExpression
other
.containsSyntacticEqualJavaExpression
in class JavaExpression
other
- the JavaExpression to search forother
public boolean containsModifiableAliasOf(Store<?> store, JavaExpression other)
JavaExpression
other
appears anywhere in this or an expression appears
in this 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'.
containsModifiableAliasOf
in class JavaExpression
public <R,P> R accept(JavaExpressionVisitor<R,P> visitor, P p)
JavaExpression
accept
in class JavaExpression
R
- result type of the operationP
- parameter typevisitor
- the visitor to be applied to this JavaExpressionp
- the parameter for this operation