You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Paolo Piersanti <pa...@micso.it> on 2015/06/25 22:15:24 UTC

closure calls routing

For sure I misunderstood something about how closure calls are routed.


For instance in groovy version 2.4.2:
<----------
target = 'aTarget'
c = new GroovyShell().evaluate("{ -> leftShift('*') }");
c.resolveStrategy = Closure.DELEGATE_ONLY
c.delegate = target
c.call()
----------->

the result is how expected:

aTarget*

but if I change the strategy to:
c.resolveStrategy = Closure.DELEGATE_FIRST

the result is:
Exception thrown

groovy.lang.MissingMethodException: No signature of method:
Script1$_run_closure1.doCall() is applicable for argument types:
(java.lang.String) values: [*]
Possible solutions: doCall(), findAll(), findAll(),
isCase(java.lang.Object), isCase(java.lang.Object)
	at Script1$_run_closure1.doCall(Script1.groovy:1)
	at ConsoleScript33.run(ConsoleScript33:5)

Shouldn't the delegate (target string) be looked up first and used ?

Thank You in advance
Paolo Piersanti


-- 
    Signature for Rent - Questo spazio si affitta
Paolo Piersanti  Software Developer & System Admininistrator



Re: closure calls routing

Posted by Pascal Schumacher <pa...@gmx.net>.
Thanks!

Am 29.06.2015 um 09:57 schrieb Paolo Piersanti:
> On 06/27/15 00:09, Pascal Schumacher wrote:
>> Hi Paolo,
>>
>> yes, please open a bug report.
> Ok, https://issues.apache.org/jira/browse/GROOVY-7480
>
>
> Paolo Piersanti
>
>


Re: closure calls routing

Posted by Paolo Piersanti <pa...@micso.it>.
On 06/27/15 00:09, Pascal Schumacher wrote:
> Hi Paolo,
> 
> yes, please open a bug report.

Ok, https://issues.apache.org/jira/browse/GROOVY-7480


Paolo Piersanti


-- 
   Signature for Rent - Questo spazio si affitta
Paolo Piersanti  Software Developer & System Admininistrator


Re: closure calls routing

Posted by Pascal Schumacher <pa...@gmx.net>.
Hi Paolo,

yes, please open a bug report.

Thanks,
Pascal

Am 26.06.2015 um 09:37 schrieb Paolo Piersanti:
> On 06/26/15 06:04, Jochen Theodorou wrote:
>> hmmm I wonder if the change 737bbe1f326ca1a43184dde7e544b67be546cc5e
>> introduced that. It seems the logic in MetaClassImpl and in
>> ClosureMetaClass differ for this case. So we do have a bug for sure. But
>> I agree, something is not right here
>>
>> bye blackdrag
>>
> Thank You for your answer.
> Should I open a bug report for this ?
>
> Paolo Piersanti
>


Re: closure calls routing

Posted by Paolo Piersanti <pa...@micso.it>.
On 06/26/15 06:04, Jochen Theodorou wrote:
> 
> hmmm I wonder if the change 737bbe1f326ca1a43184dde7e544b67be546cc5e
> introduced that. It seems the logic in MetaClassImpl and in
> ClosureMetaClass differ for this case. So we do have a bug for sure. But
> I agree, something is not right here
> 
> bye blackdrag
> 
Thank You for your answer.
Should I open a bug report for this ?

Paolo Piersanti

-- 
   Signature for Rent - Questo spazio si affitta
Paolo Piersanti  Software Developer & System Admininistrator


Re: closure calls routing

Posted by Jochen Theodorou <bl...@gmx.org>.
Am 25.06.2015 22:15, schrieb Paolo Piersanti:
> For sure I misunderstood something about how closure calls are routed.
>
>
> For instance in groovy version 2.4.2:
> <----------
> target = 'aTarget'
> c = new GroovyShell().evaluate("{ -> leftShift('*') }");
> c.resolveStrategy = Closure.DELEGATE_ONLY
> c.delegate = target
> c.call()
> ----------->
>
> the result is how expected:
>
> aTarget*
>
> but if I change the strategy to:
> c.resolveStrategy = Closure.DELEGATE_FIRST
>
> the result is:
> Exception thrown
>
> groovy.lang.MissingMethodException: No signature of method:
> Script1$_run_closure1.doCall() is applicable for argument types:

hmmm I wonder if the change 737bbe1f326ca1a43184dde7e544b67be546cc5e 
introduced that. It seems the logic in MetaClassImpl and in 
ClosureMetaClass differ for this case. So we do have a bug for sure. But 
I agree, something is not right here

bye blackdrag


-- 
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/