Class RecursivenessTester

java.lang.Object
org.codehaus.groovy.transform.tailrec.RecursivenessTester

public class RecursivenessTester extends Object
Test if a method call is recursive if called within a given method node. Handles static calls as well.

Currently known simplifications:

  • Does not check for method overloading or overridden methods
  • Does not check for matching return types; even void and any object type are considered to be compatible
  • Argument type matching could be more specific in case of static compilation
  • Method names via a GString are never considered to be recursive
  • Constructor Details

    • RecursivenessTester

      public RecursivenessTester()
  • Method Details

    • isRecursive

      public boolean isRecursive(Map<String,ASTNode> params)
      Tests whether the supplied call node is recursive within the supplied method node.
      Parameters:
      params - a map containing method and call entries
      Returns:
      true if the call is recursive; false otherwise
    • isRecursive

      public boolean isRecursive(MethodNode method, MethodCallExpression call)
      Tests whether an instance-style method call is recursive.
      Parameters:
      method - the enclosing method
      call - the method call to inspect
      Returns:
      true if the call targets the enclosing method; false otherwise
    • isRecursive

      public boolean isRecursive(MethodNode method, StaticMethodCallExpression call)
      Tests whether a static method call is recursive.
      Parameters:
      method - the enclosing method
      call - the static method call to inspect
      Returns:
      true if the call targets the enclosing method; false otherwise