Frédéric Chuong created GROOVY-10516:
----------------------------------------
Summary: 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: 3.0.9, 2.5.15, 2.4.21
Reporter: Frédéric Chuong
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)