You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/02 15:07:00 UTC
[jira] [Resolved] (GROOVY-9915) STC: call to static method fails
with incompatible generics error
[ https://issues.apache.org/jira/browse/GROOVY-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-9915.
---------------------------------
Fix Version/s: 4.0.0-alpha-3
Resolution: Fixed
> STC: call to static method fails with incompatible generics error
> -----------------------------------------------------------------
>
> Key: GROOVY-9915
> URL: https://issues.apache.org/jira/browse/GROOVY-9915
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.5.14, 3.0.7, 4.0.0-alpha-2
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-alpha-3
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> class C {
> void m() {
> init(Collections.emptyList())
> }
> private static void init(List<String> strings) {
> print strings
> }
> }
> new C().m()
> {code}
> Call to "init" is fails to match {{Collections.emptyList()}} to {{List<String>}}. If "init" is non-static, it works fine. Error displayed is:
> {code}
> Static type checking] - Cannot call C#init(java.util.List <java.lang.String>) with arguments [java.util.List <T extends java.lang.Object>]
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)