我有以下一段代码
def normalFactorial = { BigInteger n ->
n <= 1 ? 1 : normalFactorial(n - 1) * n
}
println normalFactorial(1)
println normalFactorial(2)
normalFactorial(1) 方法工作正常并按预期打印 1。第二次调用失败,出现以下异常。任何线索.. ????
May 09, 2013 10:39:23 PM org.codehaus.groovy.runtime.StackTraceUtils sanitize
WARNING: Sanitizing stacktrace:
groovy.lang.MissingMethodException: No signature of method: tailRecursion.normalFactorial() is applicable for argument types: (java.math.BigInteger) values: [1]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)