Class NodeUtils

java.lang.Object
org.checkerframework.dataflow.util.NodeUtils

public class NodeUtils extends Object
A utility class to operate on a given Node.
  • Constructor Details

    • NodeUtils

      public NodeUtils()
  • Method Details

    • isBooleanTypeNode

      public static boolean isBooleanTypeNode(Node node)
      Returns true iff node corresponds to a boolean typed expression (either the primitive type boolean, or class type Boolean).
      Returns:
      true iff node corresponds to a boolean typed expression (either the primitive type boolean, or class type Boolean)
    • isArrayLengthFieldAccess

      public static boolean isArrayLengthFieldAccess(Node node)
      Returns true iff node is a FieldAccessNode that is an access to an array's length.
      Returns:
      true iff node is a FieldAccessNode that is an access to an array's length
    • isMethodInvocation

      public static boolean isMethodInvocation(Node node, ExecutableElement method, ProcessingEnvironment env)
      Returns true if node is an invocation of the given method.
      Parameters:
      node - a node, not necessarily a method invocation
      method - a method
      env - a processing environment
      Returns:
      true if node is an invocation of one of the given methods
    • isMethodInvocation

      public static boolean isMethodInvocation(Node node, List<ExecutableElement> methods, ProcessingEnvironment env)
      Returns true iff node is an invocation of one of the given methods.
      Parameters:
      node - a node, not necessarily a method invocation
      methods - a list of methods
      env - a processing environment
      Returns:
      true if node is an invocation of one of the given methods
    • isConstantBoolean

      public static boolean isConstantBoolean(Node n, boolean value)
      Returns true if the given node statically evaluates to value and has no side effects.
      Parameters:
      n - a node
      value - 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 any TypeCastNodes wrapping a node, returning the operand nested within the type casts.
      Parameters:
      node - a node
      Returns:
      node, but with any surrounding typecasts removed