Details
Description
Groovy 2.4.21 / 2.5.14 / 3.0.9
Script.groovy
@groovy.transform.Field java.util.List list
produces the following error:
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
This does not happen when the code relies on implicit imports:
Script.groovy
@groovy.transform.Field List list
This also seems fine with Groovy 4.0.0