You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:33:01 UTC

[jira] [Closed] (GROOVY-10337) STC rejects program on compiling constructor initialization with a wildcard type

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

Paul King closed GROOVY-10337.
------------------------------

> STC rejects program on compiling constructor initialization with a wildcard type
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-10337
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10337
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-beta-2
>
>
> I have the following program
> {code:java}
> class A<T1, T2> {
>   A(A<T2, ? extends T2> y) {}
> }
> class Test<T> {
>   void test() {
>     A<Number, T> x = new A<Number, T>((A<T, T>) null);
>   }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 7: [Static type checking] - Cannot call A#<init>(A<T, ? extends java.lang.Object>) with arguments [A<T, T>]
>  @ line 7, column 22.
>        A<Number, T> x = new A<Number, T>((A<T, T>) null);
>                         ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master (commit: https://github.com/apache/groovy/commit/936983152430a7c030522126eb9e505c04cfb575)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)