Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Consider the following:
import java.util.function.Supplier @groovy.transform.CompileStatic class C { private String getX() { 'x' } void test() { Supplier<String> s = () -> x // GroovyCastException: Cannot cast object 'class C' with class 'java.lang.Class' to class 'C' print s.get() } } new C().test()
If variable expression "x" is replaced by "getX()" this runs successfully. Also works if lambda is replaced by closure. And not compile static works too.