Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-beta-4
-
None
-
None
Description
ClosureDelegateTest.groovy:
package org.mccrindle.groovy.spring;
class ClosureDelegateTest extends GroovyTestCase {
void testClosureDelegate() {
cdb = new ClosureDelegateBuilder();
try {
cdb.one() {
two(map: [ "key":
three(key: "value", anotherkey: "anothervalue")
])
}
} catch(MissingMethodException e)
}
}
ClosureDelegateBuilder.java:
/*
* Created on Mar 13, 2004
*/
package org.mccrindle.groovy.spring;
import java.util.Map;
import groovy.lang.Closure;
/**
* @author jamie
*/
public class ClosureDelegateBuilder {
public void one(Closure closure)
{ closure.setDelegate(this); closure.call(); }public void two(Map map) {}
public void three(Map map, Closure closure) { closure.setDelegate(this); closure.call(); }
}
results in the following MissingMethodException:
groovy.lang.MissingMethodException: No such method: three for class:
org.mccrindle.groovy.spring.ClosureDelegateTest$1 with arguments:
[[key:value, anotherkey:anothervalue],
org.mccrindle.groovy.spring.ClosureDelegateTest$2@353154]
at groovy.lang.MetaClass.invokeMethod(MetaClass.java:271)
whereas it should say that four() is the missing method...