[groovy-user] Static closure calling static method problem

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[groovy-user] Static closure calling static method problem

Edward Povazan
Hello,

class Test {
        private static void doit() { }
        static theClosure = { doit() }
}

Test.theClosure.call()

groovy.lang.MissingMethodException: No signature of method
Test$__clinit__closure1.doit() is applicable for argument types: () values: {}

If I explicity say Test.doit() things work as expected. Is this intensional?


Thanks
-Ed

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] Static closure calling static method problem

Edward Povazan
I wonder, is this related too? How can I do what the following code intends?

class Test {
        static _doit = Test.&doit
        static void doit() {
        }
}
Test._doit.call()
Exception thrown: groovy.lang.MissingMethodException: No signature of method
java.lang.Class.doit() is applicable for argument types: () values: {}

-Ed

Edward Povazan wrote:

> Hello,
>
> class Test {
>     private static void doit() { }
>     static theClosure = { doit() }
> }
>
> Test.theClosure.call()
>
> groovy.lang.MissingMethodException: No signature of method
> Test$__clinit__closure1.doit() is applicable for argument types: ()
> values: {}
>
> If I explicity say Test.doit() things work as expected. Is this
> intensional?
>
>
> Thanks
> -Ed
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] Static closure calling static method problem

Jochen Theodorou
Edward Povazan schrieb:
> I wonder, is this related too? How can I do what the following code
> intends?
>
> class Test {
>     static _doit = Test.&doit
>     static void doit() {
>     }
> }

we have a bug report for method closures of static closures, so this one
is nown and will be fixed

bye blackdrag

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] Static closure calling static method problem

Jochen Theodorou
In reply to this post by Edward Povazan
Edward Povazan schrieb:

> Hello,
>
> class Test {
>     private static void doit() { }
>     static theClosure = { doit() }
> }
>
> Test.theClosure.call()
>
> groovy.lang.MissingMethodException: No signature of method
> Test$__clinit__closure1.doit() is applicable for argument types: ()
> values: {}
>
> If I explicity say Test.doit() things work as expected. Is this
> intensional?

no, its a bug

bye blackdrag

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email