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

Eric Milles resolved GROOVY-10226.
----------------------------------
    Resolution: Fixed

> LUB is computed incorrectly when involving bounded type variables
> -----------------------------------------------------------------
>
>                 Key: GROOVY-10226
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10226
>             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 Foo<T> {}class Main {
>   static final <T extends Foo<String>> T test() {
>     final T x = null;
>     true ? (T) null: x
>   }
> }
> {code}
> h3. Actual behaviour
> groovyc rejects the above program and produces
>  
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 6: [Static type checking] - Cannot return value of type 
> Foo<java.lang.Object> on method returning type T
>  @ line 6, column 5.
>        true ? (T) null: x
>        ^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
>  
> Note that if I replace the bound of type parameter `T` with a 
> non-parameterized bound (e.g., Number), groovyc compiles the program as 
> expected.
>  
> Tested against master
>  
>  
>  



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

Reply via email to