Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
Description
I have the following program
interface Bar<V> { default V get(Object x, Object y) { return null; } } class Foo<V> implements Bar<V> { static <V> Foo<V> create() { return null; } } class Main { static final void test() { Number x = Foo.<Number>create().get(null, null); } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 11: [Static type checking] - Cannot assign value of type java.lang.Object to variable of type java.lang.Number @ line 11, column 16. Number x = Foo.<Number>create().get(null, null); ^ 1 error
Expected behavior
Compile successfully
Notes
Tested against master (commit: 5bcd83e0fde722971f97d479f1a4d6da6cd4aa5f)
Test cased adapt from the following program that uses the Guava lib
import com.google.common.collect.HashBasedTable; class Main { static final void test() { Number x = HashBasedTable.<Number, Number, Number>create().get(null, null); } }
Attachments
Issue Links
- is related to
-
GROOVY-8638 CompileStatic fails with Guava Multimap#asMap
- Closed
-
GROOVY-10120 STC: Guava Multimap#asMap bridge method
- Closed
- relates to
-
GROOVY-11035 Inferred type is Object when having a complex inheritance chain of interfaces
- Closed