Class ValueLiteral
java.lang.Object
org.checkerframework.dataflow.expression.JavaExpression
org.checkerframework.dataflow.expression.ValueLiteral
JavaExpression for literals.
-
Field Summary
Modifier and TypeFieldDescriptionThe value of the literal.Fields inherited from class org.checkerframework.dataflow.expression.JavaExpression
type
-
Constructor Summary
ConstructorDescriptionValueLiteral
(TypeMirror type, @Nullable Object value) Creates a ValueLiteral where the value isvalue
that has the given type.ValueLiteral
(TypeMirror type, ValueLiteralNode node) Creates a ValueLiteral from the node with the given type. -
Method Summary
Modifier and TypeMethodDescription<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 ifother
appears anywhere in this or an expression appears in this such thatother
might alias this expression, and that expression is modifiable.boolean
containsOfClass
(Class<? extends JavaExpression> clazz) boolean
Returns true if and only if this contains a JavaExpression that is syntactically equal toother
.boolean
getValue()
Returns the value of this literal.int
hashCode()
boolean
isDeterministic
(AnnotationProvider provider) Returns true if the expression is deterministic.boolean
Returns true if and only if the value this expression stands for cannot be changed (with respect to ==) by a method call.boolean
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.negate()
Returns the negation of this literal.boolean
Returns true if and only if the two Java expressions are syntactically identical.toString()
Methods inherited from class org.checkerframework.dataflow.expression.JavaExpression
atConstructorInvocation, atFieldAccess, atMethodBody, atMethodInvocation, atMethodInvocation, containsUnknown, fromArrayAccess, fromNode, fromNodeFieldAccess, fromTree, fromVariableTree, getFormalParameters, getImplicitReceiver, getParametersAsLocalVariables, getPseudoReceiver, getReceiver, getType, listContainsSyntacticEqualJavaExpression, listIsDeterministic, syntacticEqualsList, toStringDebug
-
Field Details
-
value
The value of the literal.
-
-
Constructor Details
-
ValueLiteral
Creates a ValueLiteral from the node with the given type.- Parameters:
type
- type of the literalnode
- the literal represents by thisValueLiteral
-
ValueLiteral
Creates a ValueLiteral where the value isvalue
that has the given type.- Parameters:
type
- type of the literalvalue
- the literal value
-
-
Method Details
-
negate
Returns the negation of this literal. Throws an exception if negation is not possible.- Returns:
- the negation of this literal
-
getValue
Returns the value of this literal.- Returns:
- the value of this literal
-
containsOfClass
- Specified by:
containsOfClass
in classJavaExpression
-
isDeterministic
Description copied from class:JavaExpression
Returns true if the expression is deterministic.- Specified by:
isDeterministic
in classJavaExpression
- Parameters:
provider
- an annotation provider (a type factory)- Returns:
- true if this expression is deterministic
-
isUnassignableByOtherCode
public boolean isUnassignableByOtherCode()Description copied from class:JavaExpression
Returns true if and only if the value this expression stands for cannot be changed (with respect to ==) by a method call. This is the case for local variables, the self reference, final field accesses whose receiver isJavaExpression.isUnassignableByOtherCode()
, and operations whose operands are allJavaExpression.isUnmodifiableByOtherCode()
.- Specified by:
isUnassignableByOtherCode
in classJavaExpression
- See Also:
-
isUnmodifiableByOtherCode
public boolean isUnmodifiableByOtherCode()Description copied from class:JavaExpression
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.Approximately, this returns true if the expression is
JavaExpression.isUnassignableByOtherCode()
and its type is immutable.- Specified by:
isUnmodifiableByOtherCode
in classJavaExpression
- See Also:
-
syntacticEquals
Description copied from class:JavaExpression
Returns 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:
syntacticEquals
in 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:JavaExpression
Returns true if and only if this contains a JavaExpression that is syntactically equal toother
.- Specified by:
containsSyntacticEqualJavaExpression
in 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:JavaExpression
Returns true if and only ifother
appears anywhere in this or an expression appears in this such thatother
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'.
- Overrides:
containsModifiableAliasOf
in classJavaExpression
-
equals
-
toString
-
hashCode
public int hashCode() -
accept
Description copied from class:JavaExpression
Accept method of the visitor pattern.- Specified by:
accept
in 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
-