You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:17:53 UTC

[jira] [Closed] (GROOVY-8003) Closure without parameters memoization works only with call()

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

Paul King closed GROOVY-8003.
-----------------------------

> Closure without parameters memoization works only with call()
> -------------------------------------------------------------
>
>                 Key: GROOVY-8003
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8003
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.7
>         Environment: OS: Windows 8 64bit
> IDE : Eclipse
>            Reporter: Vishnu Ramana
>            Assignee: John Wagenleitner
>
> When implementing memoization on closures present in another class, it works properly when calling the closure using .call(). But it does not work when I call it normally like a method.
> For Example:
> {code:title=Tester.groovy|borderStyle=solid}
> public class Tester  {
>     static main (String[] args){
>         Sample sample = new Sample();
>         println sample.printer.call();  \\works
>         println sample.printer.call();  \\works
>         sample = new Sample();
>         println sample.printer();  \\does not work
>         println sample.printer();  \\does not work
>     }
> }
> class Sample{
>     def  printer= {
>         println "inside"
>         true;
>     }.memoize();
> }
> {code}
> Console log:
> {code}
> inside
> true
> true
> Caught: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.runtime.memoize.Memoize$MemoizeFunction.doCall() is applicable for argument types: () values: []
> Possible solutions: call(), call([Ljava.lang.Object;), call(java.lang.Object), call([Ljava.lang.Object;), equals(java.lang.Object), isCase(java.lang.Object)
> groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.runtime.memoize.Memoize$MemoizeFunction.doCall() is applicable for argument types: () values: []
> Possible solutions: call(), call([Ljava.lang.Object;), call(java.lang.Object), call([Ljava.lang.Object;), equals(java.lang.Object), isCase(java.lang.Object)
>     at Tester.main(Tester.groovy:12)
> {code}



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