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 2019/04/24 16:28:00 UTC

[jira] [Commented] (GROOVY-8990) No compiler error for mismatched generics when using &

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

Eric Milles commented on GROOVY-8990:
-------------------------------------

Looks like {{GenericsVisitor.checkGenericsUsage}} performs this sort of checking.  It lacks multiple upper bound testing.

> No compiler error for mismatched generics when using &
> ------------------------------------------------------
>
>                 Key: GROOVY-8990
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8990
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.16, 3.0.0-alpha-4, 2.5.6
>            Reporter: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:java}
> interface I {}
> class C<T extends Number & I> { T meth() {} }
> class X extends C<Integer> {} // should produce error "The type Integer is not a valid substitute for the bounded parameter <T extends java.lang.Number & I>"
> new C<Integer>() // should produce error "The type Integer is not a valid substitute for the bounded parameter <T extends java.lang.Number & I>"
> {code}
> If the type bound Number is not satisfied, an error is produced.  However, failure to satisfy the additional interface(s) does not produce a compiler error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)