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 2022/02/28 10:37:00 UTC

[jira] [Commented] (GROOVY-10516) Script @groovy.transform.Field AST transformation generics handling with fully qualified types

    [ https://issues.apache.org/jira/browse/GROOVY-10516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498821#comment-17498821 ] 

Paul King commented on GROOVY-10516:
------------------------------------

This appears fixed in Groovy 4.0.0.

> Script @groovy.transform.Field AST transformation generics handling with fully qualified types
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10516
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10516
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.21, 2.5.15, 3.0.9
>            Reporter: Frédéric Chuong
>            Priority: Minor
>
> Groovy 2.4.21 / 2.5.14 / 3.0.9
> {code:groovy|title=Script.groovy|borderColor=red}
> @groovy.transform.Field
> java.util.List list
> {code}
> produces the following error:
> {noformat}
> startup failed:
> xxx\Script.groovy: 1: A transform used a generics containing ClassNode java.util.List <E extends java.lang.Object> for the field list directly. You are not supposed to do this. Please create a new ClassNode referring to the old ClassNode and use the new ClassNode instead of the old one. Otherwise the compiler will create wrong descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer of the transform.
>  @ line 1, column 1.
>    @groovy.transform.Field
>    ^
> xxx\Script.groovy: -1: A transform used a generics containing ClassNode java.util.List <E extends java.lang.Object> for the method public void setList(java.util.List list)  { ... } directly. You are not supposed to do this. Please create a new ClassNode referring to the old ClassNode and use the new ClassNode instead of the old one. Otherwise the compiler will create wrong descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer of the transform.
>  @ line -1, column -1.
> 2 errors
> {noformat}
> This does not happen when the code relies on implicit imports:
> {code:groovy|title=Script.groovy|borderColor=green}
> @groovy.transform.Field
> List list
> {code}
> This also seems fine with Groovy 4.0.0



--
This message was sent by Atlassian Jira
(v8.20.1#820001)