Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.12
-
None
Description
I wanted to memorize a method in a trait, basically the following:
import groovy.transform.Memoized trait T { @Memoized double method() { Math.random() } } class A implements T {} class B implements T {} def a = new A() println a.method() println a.method() println new A().method() println new B().method()
And was surprised to see that they all returned different results.
If this isn't supported, could we at least warn in case of AST transformations being applied to traits (i.e. http://docs.groovy-lang.org/next/html/documentation/core-traits.html#_compatibility_with_ast_transformations)?