[ https://issues.apache.org/jira/browse/GROOVY-11381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-11381. ------------------------------ > STC: field and interface default method accessor property > --------------------------------------------------------- > > Key: GROOVY-11381 > URL: https://issues.apache.org/jira/browse/GROOVY-11381 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Major > Fix For: 5.0.0-alpha-9 > > > Consider the following: > {code:java} > package p; > public interface I { > default Number getFoo() { return 42; } > } > {code} > {code:groovy} > class C implements p.I { > private String foo > } > @groovy.transform.CompileStatic > void test(C c) { > def foo = c.foo > print foo > } > test(new C()) > {code} > This script prints "42" but the inferred type of "c.foo" is String. Changing > "def" to "Number" results in: Cannot assign value of type java.lang.String to > variable of type java.lang.Number -- This message was sent by Atlassian Jira (v8.20.10#820010)