You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/21 15:17:00 UTC

[jira] [Resolved] (GROOVY-7293) @Memoized ignored in trait methods

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

Eric Milles resolved GROOVY-7293.
---------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> @Memoized ignored in trait methods
> ----------------------------------
>
>                 Key: GROOVY-7293
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7293
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.0
>            Reporter: Pavel Alexeev
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>
> {code}
> import groovy.transform.Memoized
> trait Mem{
>     @Memoized
>     long traitLongComputation(int seed) {
>         System.nanoTime()
>     }
> }
> class CMem{
>     @Memoized
>     long classLongComputation(int seed) {
>         System.nanoTime()
>     }   
> }
> def m = new CMem() as Mem
> assert m.classLongComputation(1) == m.classLongComputation(1)
> assert m.traitLongComputation(1) == m.traitLongComputation(1)
> {code}
> {noformat}
> Assertion failed: 
> assert m.traitLongComputation(1) == m.traitLongComputation(1)
>        | |                       |  | |
>        | 277756345937226         |  | 277756346056532
>        CMem9_groovyProxy@3ef440d5|  CMem9_groovyProxy@3ef440d5
>                                  false
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)