You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2016/08/02 11:50:09 UTC

groovy git commit: GROOVY-7774: Collection addAll fails CompileStatic type checking when adding a collection of subtypes (minor refactor)

Repository: groovy
Updated Branches:
  refs/heads/master a0aee5b31 -> 54f00a236


GROOVY-7774: Collection addAll fails CompileStatic type checking when adding a collection of subtypes (minor refactor)


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

Branch: refs/heads/master
Commit: 54f00a2361b559f3eea32d442f5e86926eee5cf0
Parents: a0aee5b
Author: paulk <pa...@asert.com.au>
Authored: Tue Aug 2 21:50:01 2016 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Tue Aug 2 21:50:01 2016 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/runtime/DefaultGroovyMethods.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/54f00a23/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index e952f0d..130898b 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -5176,9 +5176,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
             G key = outer.getKey();
             List<Map.Entry<K, V>> entries = outer.getValue();
             Map<K, V> target = createSimilarMap(self);
-            for (Map.Entry<K, V> entry : entries) {
-                target.put(entry.getKey(), entry.getValue());
-            }
+            putAll(target, entries);
             answer.put(key, target);
         }
         return answer;
@@ -8905,7 +8903,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return the same map, after the items have been added to it.
      * @since 1.6.1
      */
-    public static <K, V> Map<K, V> putAll(Map<K, V> self, Collection<Map.Entry<? extends K, ? extends V>> entries) {
+    public static <K, V> Map<K, V> putAll(Map<K, V> self, Collection<? extends Map.Entry<? extends K, ? extends V>> entries) {
         for (Map.Entry<? extends K, ? extends V> entry : entries) {
             self.put(entry.getKey(), entry.getValue());
         }
@@ -8925,7 +8923,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return a new Map containing all key, value pairs from self and entries
      * @since 1.6.1
      */
-    public static <K, V> Map<K, V> plus(Map<K, V> self, Collection<Map.Entry<? extends K, ? extends V>> entries) {
+    public static <K, V> Map<K, V> plus(Map<K, V> self, Collection<? extends Map.Entry<? extends K, ? extends V>> entries) {
         Map<K, V> map = cloneSimilarMap(self);
         putAll(map, entries);
         return map;