Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:JDK 1.6.x, Grails 1.2.1
-
Number of attachments :
Description
I've got a grails app with Service classes that inherit from Groovy's GroovyInterceptable:
[code]
class customerSerrvice implements GroovyInterceptable {
private List<Customer> customers
def invokeMethod(String name, args)
{ log.debug "=======>INVOKING method [$name] with args:$args" }
void foo() {
customers.each
}
void doSomething(Customer cust) { log.debug "doSomething invoked with $cust" }
}
[/code]
If I call foo() or doSomething() *directly* from another class, the invokeMethod gets called like it is supposed to. However, when foo() calls doSomething(), that call is not intercepted in invokeMethod.
If I change from
`customers.each { doSomething(it) }
`
to
`for(Customer cust: customers)
`
then the invokeMethod gets called just fine.
There appears to be an ExpandoMetaClass bug that prevents closures and GroovyInterceptable from working together.