[
https://issues.apache.org/jira/browse/GROOVY-10256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17419268#comment-17419268
]
Eric Milles commented on GROOVY-10256:
--------------------------------------
And:
{code:groovy}
class C<T> {
void accept(T t) {
}
def <X extends Number> X produce() {
}
@groovy.transform.TypeChecked
void test() {
accept(produce()) // not compatible
}
}
{code}
> STC: no error for incompatible type bounds on return value
> ----------------------------------------------------------
>
> Key: GROOVY-10256
> URL: https://issues.apache.org/jira/browse/GROOVY-10256
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 4.0.0-beta-1
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> def <T extends CharSequence> T chars() {
> "foo"
> }
> @groovy.transform.TypeChecked
> List test() {
> chars()
> }
> {code}
> The return type extends {{CharSequence}}, which is incompatible with
> {{List}}. No STC error is produced. This is a follow up from GROOVY-7316.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)