[
https://issues.apache.org/jira/browse/GROOVY-10363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10363:
---------------------------------
Fix Version/s: 3.0.11
> STC produces compile-time error on encoutering bounded type parameter with
> conditional
> --------------------------------------------------------------------------------------
>
> Key: GROOVY-10363
> URL: https://issues.apache.org/jira/browse/GROOVY-10363
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1, 3.0.11, 4.0.3
>
>
> I have the following program:
> {code:groovy}
> import java.util.function.Supplier;
> class A {
> static final <X extends Supplier<Number>> X m(X x, X y) {
> X z = (true) ? x : y
> z
> }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 10: [Static type checking] - Incompatible generic argument
> types. Cannot assign java.util.function.Supplier<java.lang.Object> to: X
> @ line 10, column 5.
> z
> ^
> 1 error
> {code}
> h3. Compile successfully
> NOTE: The bug is triggered only when the type parameter is named other than
> `T`.
> Tested against master
--
This message was sent by Atlassian Jira
(v8.20.7#820007)