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:17:37 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 8c193c7b3 -> 690d1e487


Trivial refactoring


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

Branch: refs/heads/master
Commit: 690d1e4870c4107e78bfb05fc0fa23886c3cddd1
Parents: 8c193c7
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:31 2017 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/690d1e48/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