[ 
https://issues.apache.org/jira/browse/GROOVY-6659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15534170#comment-15534170
 ] 

John Wagenleitner commented on GROOVY-6659:
-------------------------------------------

This fails to compile on master with the message {{The type C is not a valid 
substitute for the bounded parameter <V extends A>}}.  It also fails if the two 
{{CompileStatic}} annotations are removed.

> generic bounds ignored by type checking
> ---------------------------------------
>
>                 Key: GROOVY-6659
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6659
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.3.0, 2.2.3, 2.4.0-beta-3
>            Reporter: Jochen Theodorou
>
> {code:Java}
> class A{}
> class B{}
> @groovy.transform.CompileStatic
> class Helper<V extends A> {
>            public Helper(Closure<V> cl) {}
>        }
> @groovy.transform.CompileStatic
>        static <C extends B> void extensionMethod(Closure<C> cl) {
>            new Helper<C>(cl)
>        }
> {code}
> The example is inspired by the fix done for GROOVY-6657, not sure versions 
> before are affected, since this kind of code failed before. So it might be 
> seen as regression.
> Anyway, the code above should not compile, since Helper cannot extend A and B 
> at the same time.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to