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/02/14 17:06:00 UTC

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

Eric Milles created GROOVY-8990:
-----------------------------------

             Summary: 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.5.6, 3.0.0-alpha-4, 2.4.16
            Reporter: Eric Milles


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)