You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Eddelbuettel (Jira)" <ji...@apache.org> on 2022/10/24 17:33:00 UTC

[jira] [Updated] (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 ]

Jochen Eddelbuettel updated GROOVY-10795:
-----------------------------------------
    Affects Version/s: 4.0.6
                       3.0.11
          Description: 
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.

  was:
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.


> 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
>            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)