Class NodeUtils
java.lang.Object
org.checkerframework.dataflow.util.NodeUtils
A utility class to operate on a given
Node.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisArrayLengthFieldAccess(Node node) Returns true iffnodeis aFieldAccessNodethat is an access to an array's length.static booleanisBooleanTypeNode(Node node) Returns true iffnodecorresponds to a boolean typed expression (either the primitive typeboolean, or class typeBoolean).static booleanisConstantBoolean(Node n, boolean value) Returns true if the given node statically evaluates tovalueand has no side effects.static booleanisMethodInvocation(Node node, List<ExecutableElement> methods, ProcessingEnvironment env) Returns true iffnodeis an invocation of one of the given methods.static booleanisMethodInvocation(Node node, ExecutableElement method, ProcessingEnvironment env) Returns true ifnodeis an invocation of the given method.static NoderemoveCasts(Node node) Remove anyTypeCastNodes wrapping a node, returning the operand nested within the type casts.
-
Constructor Details
-
NodeUtils
public NodeUtils()
-
-
Method Details
-
isBooleanTypeNode
Returns true iffnodecorresponds to a boolean typed expression (either the primitive typeboolean, or class typeBoolean).- Returns:
- true iff
nodecorresponds to a boolean typed expression (either the primitive typeboolean, or class typeBoolean)
-
isArrayLengthFieldAccess
Returns true iffnodeis aFieldAccessNodethat is an access to an array's length.- Returns:
- true iff
nodeis aFieldAccessNodethat is an access to an array's length
-
isMethodInvocation
public static boolean isMethodInvocation(Node node, ExecutableElement method, ProcessingEnvironment env) Returns true ifnodeis an invocation of the given method.- Parameters:
node- a node, not necessarily a method invocationmethod- a methodenv- a processing environment- Returns:
- true if
nodeis an invocation of one of the given methods
-
isMethodInvocation
public static boolean isMethodInvocation(Node node, List<ExecutableElement> methods, ProcessingEnvironment env) Returns true iffnodeis an invocation of one of the given methods.- Parameters:
node- a node, not necessarily a method invocationmethods- a list of methodsenv- a processing environment- Returns:
- true if
nodeis an invocation of one of the given methods
-
isConstantBoolean
Returns true if the given node statically evaluates tovalueand 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
Remove anyTypeCastNodes wrapping a node, returning the operand nested within the type casts.- Parameters:
node- a node- Returns:
- node, but with any surrounding typecasts removed
-