You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/15 16:12:00 UTC

[jira] [Updated] (GROOVY-10754) Incompatible generic argument types when using wildcards

     [ https://issues.apache.org/jira/browse/GROOVY-10754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10754:
---------------------------------
    Priority: Minor  (was: Major)

> Incompatible generic argument types when using wildcards
> --------------------------------------------------------
>
>                 Key: GROOVY-10754
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10754
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Minor
>
> I have the following program
> {code}
> class A<T> {}
> class B extends A<Boolean> {}
> class C<T extends A<Boolean>, U extends T> {
>   C(T x, U v) {}
> }
> class Test {
>   void test(B x, B y) {
>     C<? extends B, ? extends B> z = new C<>(x, y);
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 12: [Static type checking] - Incompatible generic argument types. Cannot assign C<A<java.lang.Boolean>, B> to: C<? extends B, ? extends B>
>  @ line 12, column 37.
>        C<? extends B, ? extends B> z = new C<>(x, y);
>                                        ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> *Notes*: The bug happens only when the class named C has two type parameters, and the second parameter is bounded to the first one
> Tested against master (commit: 099cf5b3f0ca61ea5daa72ebcea66ef09a74fd84)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)