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

Eric Milles updated GROOVY-10153:
---------------------------------
    Fix Version/s: 3.0.20

> STC: cannot combine use-variance with bounded polymorphism
> ----------------------------------------------------------
>
>                 Key: GROOVY-10153
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10153
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.5.17, 3.0.11, 4.0.3
>            Reporter: Stefanos Chaliasos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.4, 3.0.20
>
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.TypeChecked
> class Test {
>   public void m() {
>     Foo<? super C> x = new Foo<B>();
>   }
> }
> class A {}
> class B extends A {}
> class C extends B {}
> class Foo<T extends A> {
> }
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Test.groovy: 4: The type ? is not a valid substitute for the bounded 
> parameter <T extends A>
>  @ line 4, column 9.
>        Foo<? super C> x = new Foo<B>();
>            ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to