[
https://issues.apache.org/jira/browse/GROOVY-10601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-10601:
------------------------------------
Assignee: Eric Milles
> Incompatible generic argument type when combining conditionals and bounded
> type parameters
> ------------------------------------------------------------------------------------------
>
> Key: GROOVY-10601
> URL: https://issues.apache.org/jira/browse/GROOVY-10601
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
>
> I have the following program
> {code}
> class Foo<X> {}
> class Test {
> public static <T extends Foo<Number>> T test() {
> T x = (T) null;
> T y = (true) ? x : (T) null;
> y
> }
> }
> {code}
> h3. Actual behaviour
> The compiler rejects the program with
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 8: [Static type checking] - Incompatible generic argument types.
> Cannot assign Foo<java.lang.Object> to: T
> @ line 8, column 5.
> y
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> **NOTE:** This bug occurs only when `test` and `Foo` have type parameters
> with different names.
> Tested against master (commit: 5c468cd352f37fb5c599a3f51534ffcc55b339ed).
--
This message was sent by Atlassian Jira
(v8.20.7#820007)