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 2023/02/10 21:41:00 UTC

[jira] [Closed] (GROOVY-10795) Regression: Returning List/Map created via literal as typed generic

     [ https://issues.apache.org/jira/browse/GROOVY-10795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-10795.
------------------------------

> Regression: Returning List/Map created via literal as typed generic
> -------------------------------------------------------------------
>
>                 Key: GROOVY-10795
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10795
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 3.0.11, 3.0.13, 4.0.6
>            Reporter: Jochen Eddelbuettel
>            Assignee: Eric Milles
>            Priority: Major
>
> This script 
> {code:java}
> @groovy.transform.CompileStatic
> List<String> foo() {
>     def list = [ ]
>     list << "xyz"
>     return list
> }{code}
> produces
> startup failed:
> C:\Projects\Gradle\DARWin\DARWinTester\DARWin\src\TestScript.groovy: 5: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.List <java.lang.Object> to: java.util.List <String>
>  @ line 5, column 12.
>        return list
>  
> The same code worked fine in 3.0.5 and 3.0.8.
> It last worked in 3.0.10. Version 4.0.6 produces the same error.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)