Class NodeUtils
- java.lang.Object
-
- org.checkerframework.dataflow.util.NodeUtils
-
public class NodeUtils extends java.lang.Object
A utility class to operate on a givenNode
.
-
-
Constructor Summary
Constructors Constructor Description NodeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isArrayLengthFieldAccess(Node node)
Returns true iffnode
is aFieldAccessNode
that is an access to an array's length.static boolean
isBooleanTypeNode(Node node)
Returns true iffnode
corresponds to a boolean typed expression (either the primitive typeboolean
, or class typeBoolean
).static boolean
isConstantBoolean(Node n, boolean value)
Returns true if the given node statically evaluates tovalue
and has no side effects.static boolean
isMethodInvocation(Node node, javax.lang.model.element.ExecutableElement method, javax.annotation.processing.ProcessingEnvironment env)
Returns true iffnode
is an invocation of the given method.static Node
removeCasts(Node node)
Remove anyTypeCastNode
s wrapping a node, returning the operand nested within the type casts.
-
-
-
Method Detail
-
isBooleanTypeNode
public static boolean isBooleanTypeNode(Node node)
Returns true iffnode
corresponds to a boolean typed expression (either the primitive typeboolean
, or class typeBoolean
).- Returns:
- true iff
node
corresponds to a boolean typed expression (either the primitive typeboolean
, or class typeBoolean
)
-
isArrayLengthFieldAccess
public static boolean isArrayLengthFieldAccess(Node node)
Returns true iffnode
is aFieldAccessNode
that is an access to an array's length.- Returns:
- true iff
node
is aFieldAccessNode
that is an access to an array's length
-
isMethodInvocation
public static boolean isMethodInvocation(Node node, javax.lang.model.element.ExecutableElement method, javax.annotation.processing.ProcessingEnvironment env)
Returns true iffnode
is an invocation of the given method.
-
isConstantBoolean
public static boolean isConstantBoolean(Node n, boolean value)
Returns true if the given node statically evaluates tovalue
and has no side effects.- Parameters:
n
- a nodevalue
- the boolean value that the node is tested against- Returns:
- true if the node is equivalent to a literal with value
value
-
removeCasts
public static Node removeCasts(Node node)
Remove anyTypeCastNode
s wrapping a node, returning the operand nested within the type casts.- Parameters:
node
- a node- Returns:
- node, but with any surrounding typecasts removed
-
-