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 2021/11/15 15:04:00 UTC

[jira] [Assigned] (GROOVY-10369) STC does not check the upper bounds of type parameters

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

Eric Milles reassigned GROOVY-10369:
------------------------------------

    Assignee: Eric Milles

> STC does not check the upper bounds of type parameters
> ------------------------------------------------------
>
>                 Key: GROOVY-10369
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10369
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> I have the following program
> {code:java}
> class B<T1, T2 extends T1> {}
> class Test {
>   public static void main(String[] args) {
>     var x = new B<Number, Boolean>();
>   }
> }
> {code}
> h3. Actual behaviour
> groovyc accepts and compiles the above program.
> h3. Expected behaviour
> groovyc should have rejected the above program because the second type argument at line 6(`Boolean`) is not a subtype of the first one (`Number`).
> Tested against master.



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