Class ArrayCreation
java.lang.Object
org.checkerframework.dataflow.expression.JavaExpression
org.checkerframework.dataflow.expression.ArrayCreation
JavaExpression for array creations.
new String[]()
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<@Nullable JavaExpression>
List of dimensions expressions.protected final List<JavaExpression>
List of initializers.Fields inherited from class org.checkerframework.dataflow.expression.JavaExpression
type
-
Constructor Summary
ConstructorDescriptionArrayCreation
(TypeMirror type, List<@Nullable JavaExpression> dimensions, List<JavaExpression> initializers) Creates an ArrayCreation object. -
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.boolean
Returns true if and only if this contains a JavaExpression that is syntactically equal toother
.boolean
Returns a list representing the dimensions of this array creation.int
hashCode()
boolean
Returns true if some subexpression of this can be assigned to from outside the current method body.boolean
isDeterministic
(AnnotationProvider provider) Returns true if the expression is deterministic.boolean
Returns 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.boolean
Returns 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, containsModifiableAliasOf, containsOfClass, containsUnknown, fromArrayAccess, fromNode, fromNodeFieldAccess, fromTree, fromVariableTree, getFormalParameters, getImplicitReceiver, getParametersAsLocalVariables, getPseudoReceiver, getReceiver, getType, isUnassignableByOtherCode, isUnmodifiableByOtherCode, listContainsSyntacticEqualJavaExpression, listIsDeterministic, syntacticEqualsList
-
Field Details
-
dimensions
List of dimensions expressions. A {code null} element means that there is no dimension expression for the given array level. -
initializers
List of initializers.
-
-
Constructor Details
-
ArrayCreation
public ArrayCreation(TypeMirror type, List<@Nullable JavaExpression> dimensions, List<JavaExpression> initializers) Creates an ArrayCreation object.- Parameters:
type
- array typedimensions
- list of dimension expressions; anull
element means that there is no dimension expression for the given array levelinitializers
- list of initializer expressions
-
-
Method Details
-
getDimensions
Returns a list representing the dimensions of this array creation. A {code null} element means that there is no dimension expression for the given array level.- Returns:
- a list representing the dimensions of this array creation
-
getInitializers
-
containedOfClass
Description copied from class:JavaExpression
Returns 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:
containedOfClass
in 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: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
-
isAssignableByOtherCode
public boolean isAssignableByOtherCode()Description copied from class:JavaExpression
Returns 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:
isAssignableByOtherCode
in 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:JavaExpression
Returns 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. (String
is an immutable type.)- Overrides:
isModifiableByOtherCode
in classJavaExpression
- Returns:
- true if the value of this expression can be changed from outside the current method body
- See Also:
-
hashCode
public int hashCode() -
equals
-
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
-
toString
-
toStringDebug
Description copied from class:JavaExpression
Format this verbosely, for debugging.- Overrides:
toStringDebug
in classJavaExpression
- Returns:
- a verbose string representation of this
-
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
-