[ 
https://issues.apache.org/jira/browse/GROOVY-6175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-6175.
-----------------------------

> invoking Closure property like method fails because of doCall/call 
> asynchronity
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-6175
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6175
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>            Reporter: Jochen Theodorou
>            Assignee: John Wagenleitner
>             Fix For: 2.4.8
>
>
> In this code:{code:Java}
> class Lol {
>     def clo = {
>         println "arg $it"
>     }.memoize()
> }
> {code}
> a new Lol().clo("my arg") fails, even though it should work. Looking at the 
> error message it can be seen, that the runtime tries to do a doCall, while 
> the MemoizeFunction that is stored in clo does not have that method (instead 
> it overrides call(Object[])). Looking at MetaClassImpl you can find the 
> following piece of code around line 1121:{code:Java}
>         if (value instanceof Closure) {  // This test ensures that value != 
> this If you ever change this ensure that value != this
>             Closure closure = (Closure) value;
>             MetaClass delegateMetaClass = closure.getMetaClass();
>             return delegateMetaClass.invokeMethod(closure.getClass(), 
> closure, CLOSURE_DO_CALL_METHOD, originalArguments, false, fromInsideClass);
>         }
> {code}
> That code clearly tries to do doCall, instead of call. It is to be assumed 
> that code following this does not check for both variants equally.
> Proposed fix: use call instead of doCall



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to