groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-6584) Cannot use memoize() to cache metaclass method call
Date Fri, 07 Oct 2016 04:02:20 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-6584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15554046#comment-15554046
] 

ASF GitHub Bot commented on GROOVY-6584:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/434


> Cannot use memoize() to cache metaclass method call
> ---------------------------------------------------
>
>                 Key: GROOVY-6584
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6584
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.2.1
>            Reporter: Sargis Harutyunyan
>
> Hi I want to extend my list with new method and cache the result because actually it
will query db but I am getting 'java.lang.UnsupportedOperationException', I reproduced it
for simple case also using groovy console
> {code}
> def lst = []
> lst.metaClass.getTotalCount = {
>     println ">>>>>>>>>> 12 <<<<<<<<<<"
>     12 // can be some select count(*) from xxx
> }.memoize()
> println lst.getTotalCount()
> println lst.getTotalCount()
> {code}
> I am getting
> {noformat}
> java.lang.UnsupportedOperationException: org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod$AnonymousMetaMethod
> 	at ConsoleScript10.run(ConsoleScript10:2)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message