Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-4
-
Fix Version/s: 1.1-rc-2
-
Component/s: None
-
Labels:None
-
Number of attachments :
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") {
four()
}])
}
} catch(MissingMethodException e) {
assertEquals("four", e.method);
}
}
}
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...
Seems to work fine in HEAD