groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Trivial refactoring
Date Mon, 04 Dec 2017 11:18:02 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X c247a4fe3 -> 1bff86335


Trivial refactoring

(cherry picked from commit 690d1e4)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1bff8633
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1bff8633
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1bff8633

Branch: refs/heads/GROOVY_2_6_X
Commit: 1bff863355d98e82038c67e931bdf6b6cfc2d69d
Parents: c247a4f
Author: sunlan <sunlan@apache.org>
Authored: Mon Dec 4 19:17:31 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Dec 4 19:17:56 2017 +0800

----------------------------------------------------------------------
 .../ASTTransformationCollectorCodeVisitor.java          | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/1bff8633/src/main/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
b/src/main/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
index 6a2e4e1..465e7b1 100644
--- a/src/main/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
@@ -99,9 +99,11 @@ public class ASTTransformationCollectorCodeVisitor extends ClassCodeVisitorSuppo
             findCollectedAnnotations(annotation, node, index, modes, existing, replacements);
             index++;
         }
-        for (Integer replacementIndex : replacements.keySet()) {
-            mergeCollectedAnnotations(modes.get(replacementIndex), existing, replacements.get(replacementIndex));
-            existing.put(replacementIndex, replacements.get(replacementIndex));
+        for (Map.Entry<Integer, List<AnnotationNode>> entry : replacements.entrySet())
{
+            Integer replacementIndex = entry.getKey();
+            List<AnnotationNode> annotationNodeList = entry.getValue();
+            mergeCollectedAnnotations(modes.get(replacementIndex), existing, annotationNodeList);
+            existing.put(replacementIndex, annotationNodeList);
         }
         List<AnnotationNode> mergedList = new ArrayList<AnnotationNode>();
         for (List<AnnotationNode> next : existing.values()) {
@@ -164,8 +166,8 @@ public class ASTTransformationCollectorCodeVisitor extends ClassCodeVisitorSuppo
         while (nodeIterator.hasNext()) {
             boolean remove = false;
             AnnotationNode replacement = nodeIterator.next();
-            for (Integer key : existingMap.keySet()) {
-                for (AnnotationNode existing : existingMap.get(key)) {
+            for (Map.Entry<Integer, List<AnnotationNode>> entry : existingMap.entrySet())
{
+                for (AnnotationNode existing : entry.getValue()) {
                     if (replacement.getClassNode().getName().equals(existing.getClassNode().getName()))
{
                         if (mergeParams) {
                             mergeParameters(existing, replacement);


Mime
View raw message