groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 05/06: GROOVY-9050: Missing @Generated annotation in @Sortable
Date Fri, 22 Mar 2019 01:33:40 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 9d23a132c5c85aec99f86d4ca72beaffce7eaf20
Author: Paul King <paulk@asert.com.au>
AuthorDate: Fri Mar 22 10:31:49 2019 +1000

    GROOVY-9050: Missing @Generated annotation in @Sortable
---
 src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java  | 10 ++++++++++
 .../codehaus/groovy/transform/SortableASTTransformation.java   |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
index 814b127..daf60aa 100644
--- a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
+++ b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
@@ -104,6 +104,16 @@ public class ClassNodeUtils {
     }
 
     /**
+     * Add an inner class that is marked as @Generated.
+     *
+     * @see org.codehaus.groovy.ast.ModuleNode#addClass(ClassNode)
+     */
+    public static void addGeneratedInnerClass(ClassNode cNode, ClassNode inner) {
+        cNode.getModule().addClass(inner);
+        markAsGenerated(cNode, inner);
+    }
+
+    /**
      * Add a method that is marked as @Generated.
      *
      * @see ClassNode#addConstructor(int, Parameter[], ClassNode[], Statement)
diff --git a/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
index 9886d20..e45772c 100644
--- a/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
@@ -45,6 +45,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedInnerClass;
 import static org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedMethod;
 import static org.codehaus.groovy.ast.ClassHelper.isPrimitiveType;
 import static org.codehaus.groovy.ast.ClassHelper.make;
@@ -189,7 +190,7 @@ public class SortableASTTransformation extends AbstractASTTransformation
{
         String className = classNode.getName() + "$" + propName + "Comparator";
         ClassNode superClass = makeClassSafeWithGenerics(AbstractComparator.class, classNode);
         InnerClassNode cmpClass = new InnerClassNode(classNode, className, ACC_PRIVATE |
ACC_STATIC, superClass);
-        classNode.getModule().addClass(cmpClass);
+        addGeneratedInnerClass(classNode, cmpClass);
 
         addGeneratedMethod(cmpClass,
                 "compare",


Mime
View raw message