You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/20 04:38:44 UTC
[jira] [Commented] (GROOVY-8090) Incorrectly processing
method-level type generics information
[ https://issues.apache.org/jira/browse/GROOVY-8090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874021#comment-15874021 ]
Paul King commented on GROOVY-8090:
-----------------------------------
I thought something similar had been reported already but couldn't find it with a quick search.
> Incorrectly processing method-level type generics information
> -------------------------------------------------------------
>
> Key: GROOVY-8090
> URL: https://issues.apache.org/jira/browse/GROOVY-8090
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.4.8
> Reporter: Paul King
>
> {code}
> import static java.util.Arrays.asList
> @groovy.transform.CompileStatic
> class CSTest {
> final <T> Iterable<T> foo(T instance) { asList(instance) }
> // next line fails with: [Static type checking] - Cannot call <T> java.util.Arrays#asList(T[]) with arguments [U]
> final <U> Iterable<U> bar(U instance) { asList(instance) }
> final Iterable<String> baz(String instance) { asList(instance) }
> }
> new Main().with {
> assert foo('A') + bar('B') + baz('C') == ['A', 'B', 'C']
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)