Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.7, 1.5.8
-
None
-
None
-
Only tested for Groovy 1.5.7 and 1.5.8 since i am unable to compile the project with groovy 1.8.0
Description
When running the following code:
Closure test =
{String x -> println x};
println test.metaClass.respondsTo(test, "doCall");
The resulting output is: []
Which is incorrect, since the MOP for respondsTo(Object, String) states:
[...] if the implementing MetaClass responds to a method with the given name regardless of arguments.
But the Closure does respond to doCall(String), which can easily be verified using this code:
println test.metaClass.respondsTo(test, "doCall", "Hello");
which will output something similar to: [public MyClass$_myMethod_closure1.doCall(java.lang.String)]
which tells us, that the closure does respond to doCall(String).
Hence, this meta method, and all other meta methods named doCall - regardless of their parameters - aswell, should also be included in the list returned by respondsTo(Object,String).