[
https://issues.apache.org/jira/browse/GROOVY-10351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10351:
---------------------------------
Fix Version/s: 2.5.19
> Wrong type argument is inferred on combining use-site variance and diamond
> operator
> -----------------------------------------------------------------------------------
>
> Key: GROOVY-10351
> URL: https://issues.apache.org/jira/browse/GROOVY-10351
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-rc-1, 2.5.19, 3.0.13
>
>
> This bug may be related to GROOVY-10337.
> I have the following program
> {code:java}
> class A<T> {
> A(T f, B<T, ? extends T> x){ }
> }
> class B<T1, T2> {}
> class Test {
> void test() {
> B<Integer, ? extends Integer> x = null;
> A<Integer> y = new A<>(1, x);
> }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 10: [Static type checking] - Incompatible generic argument
> types. Cannot assign A<? extends java.lang.Object> to: A<java.lang.Integer>
> @ line 10, column 20.
> A<Integer> y = new A<>(1, x);
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master
> (https://github.com/apache/groovy/commit/de17150ee844a943c070c01c07b81fd547ff074d).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)