Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.5
-
None
Description
If an inner class tries to access a @Lazy property of its outer class it will cause a MissingFieldException unless it either explicitly calls the getter or specifies the outer this.
class Outer { @Lazy lazy = 'lazy' final normal = 'normal' final inner = new Inner() class Inner { def f() { normal } def g() { Outer.this.lazy } def h() { getLazy() } def i() { lazy } } } final outer = new Outer() assert outer.normal == outer.inner.f() assert outer.lazy == outer.inner.g() assert outer.lazy == outer.inner.h() assert outer.lazy == outer.inner.i()
The expected behavior is that #g, #h and #i are equivalent.