This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 484f0ab4192d94872c2df6079668f2172664d5fb
Author: Christopher Smith <[email protected]>
AuthorDate: Thu Sep 22 15:54:50 2022 -0500

    Improve generic-ClassNode compiler error message
    
    Explain how (rather than what) should be done to refer to classes with
    generic types in AST transforms.
---
 .../java/org/codehaus/groovy/classgen/ClassCompletionVerifier.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/codehaus/groovy/classgen/ClassCompletionVerifier.java 
b/src/main/java/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
index f5ad9e825f..924b5633af 100644
--- a/src/main/java/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
+++ b/src/main/java/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
@@ -786,11 +786,12 @@ public class ClassCompletionVerifier extends 
ClassCodeVisitorSupport {
             checkGenericsUsage(ref, node.getComponentType());
         } else if (!node.isRedirectNode() && node.isUsingGenerics()) {
             addError(
-                    "A transform used a generics containing ClassNode "+ node 
+ " " +
+                    "A transform used a generics-containing ClassNode "+ node 
+ " " +
                     "for "+getRefDescriptor(ref) +
                     "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 " +
+                    "Please create a clean ClassNode using 
ClassNode#getPlainNodeReference() " +
+                    "and #setGenericsTypes(GenericsType[]) on it or use 
GenericsUtils.makeClassSafe*" +
+                    "and use the new ClassNode instead of the original 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 " +

Reply via email to