[ https://issues.apache.org/jira/browse/GROOVY-10375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10375: --------------------------------- Fix Version/s: 3.0.10 > SC: cast exception for private property access from lambda > ---------------------------------------------------------- > > Key: GROOVY-10375 > URL: https://issues.apache.org/jira/browse/GROOVY-10375 > Project: Groovy > Issue Type: Bug > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Major > Fix For: 3.0.10, 4.0.0-rc-1 > > > Consider the following: > {code:groovy} > 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() > {code} > 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. -- This message was sent by Atlassian Jira (v8.20.1#820001)