Class RecursivenessTester
java.lang.Object
org.codehaus.groovy.transform.tailrec.RecursivenessTester
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisRecursive(Map<String, ASTNode> params) Tests whether the supplied call node is recursive within the supplied method node.booleanisRecursive(MethodNode method, MethodCallExpression call) Tests whether an instance-style method call is recursive.booleanisRecursive(MethodNode method, StaticMethodCallExpression call) Tests whether a static method call is recursive.
-
Constructor Details
-
RecursivenessTester
public RecursivenessTester()
-
-
Method Details
-
isRecursive
Tests whether the supplied call node is recursive within the supplied method node.- Parameters:
params- a map containingmethodandcallentries- Returns:
trueif the call is recursive;falseotherwise
-
isRecursive
Tests whether an instance-style method call is recursive.- Parameters:
method- the enclosing methodcall- the method call to inspect- Returns:
trueif the call targets the enclosing method;falseotherwise
-
isRecursive
Tests whether a static method call is recursive.- Parameters:
method- the enclosing methodcall- the static method call to inspect- Returns:
trueif the call targets the enclosing method;falseotherwise
-