Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Consider the following:
package p; public interface I { default Number getFoo() { return 42; } }
class C implements p.I { private String foo } @groovy.transform.CompileStatic void test(C c) { def foo = c.foo print foo } test(new C())
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