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/02/05 02:21:07 UTC

[1/7] groovy git commit: fix recreation of Gradle Wrapper (outdated version)

Repository: groovy
Updated Branches:
  refs/heads/master 5f695121f -> 36381a2ab


fix recreation of Gradle Wrapper (outdated version)


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

Branch: refs/heads/master
Commit: 28777a3c232a29d55b74643601a8ea9de6185f11
Parents: 5f69512
Author: oreissig <or...@gmail.com>
Authored: Mon Feb 1 19:18:47 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:27 2016 +1000

----------------------------------------------------------------------
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/28777a3c/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index c5012cb..230fce4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -136,7 +136,7 @@ ext {
     commonsHttpClientVersion = '3.1'
     eclipseOsgiVersion = '3.9.1-v20140110-1610'
     gparsVersion = '1.2.1'
-    gradleVersion = '2.8'
+    gradleVersion = '2.10'
     ivyVersion = '2.4.0'
     jansiVersion = '1.11'
     jarjarVersion = '1.3'


[7/7] groovy git commit: add javadoc examples for Collection.removeAll(Closure) and Collection.retainAll(Closure) as well

Posted by pa...@apache.org.
add javadoc examples for Collection.removeAll(Closure) and Collection.retainAll(Closure) as well


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

Branch: refs/heads/master
Commit: 36381a2abd2b39d8dcaec08b1015e92b6eca2026
Parents: 4ad1f68
Author: oreissig <or...@gmail.com>
Authored: Thu Feb 4 21:56:21 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:36 2016 +1000

----------------------------------------------------------------------
 .../codehaus/groovy/runtime/DefaultGroovyMethods.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/36381a2a/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 c7dd01d..b8e5a15 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -4382,6 +4382,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * that are matched according to the specified closure condition.  In other words,
      * removes from this collection all of its elements that don't match.
      *
+     * <pre class="groovyTestCase">def list = ['a', 'b']
+     * list.retainAll { it == 'b' }
+     * assert list == ['b']</pre>
+     *
      * See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
      * containing items which match some criteria but leaving the original collection unchanged.
      *
@@ -4408,7 +4412,9 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     /**
      * Modifies this map so that it retains only its elements that are matched
      * according to the specified closure condition.  In other words, removes from
-     * this map all of its elements that don't match.
+     * this map all of its elements that don't match. If the closure takes one
+     * parameter then it will be passed the Map.Entry. Otherwise the closure should
+     * take two parameters, which will be the key and the value.
      *
      * <pre class="groovyTestCase">def map = [a:1, b:2]
      * map.retainAll { k,v -> k == 'b' }
@@ -4440,6 +4446,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * Modifies this collection by removing the elements that are matched according
      * to the specified closure condition.
      *
+     * <pre class="groovyTestCase">def list = ['a', 'b']
+     * list.removeAll { it == 'b' }
+     * assert list == ['a']</pre>
+     *
      * See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
      * containing items which match some criteria but leaving the original collection unchanged.
      *
@@ -4468,7 +4478,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * specified closure condition. If the closure takes one parameter then it will be
      * passed the Map.Entry. Otherwise the closure should take two parameters, which
      * will be the key and the value.
-     * 
+     *
      * <pre class="groovyTestCase">def map = [a:1, b:2]
      * map.removeAll { k,v -> k == 'b' }
      * assert map == [a:1]</pre>


[5/7] groovy git commit: remove negation from javadoc: findAll does whitelisting instead of blacklisting

Posted by pa...@apache.org.
remove negation from javadoc: findAll does whitelisting instead of blacklisting


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

Branch: refs/heads/master
Commit: 039b3e567dd65c63fe702dda54150e5393d8ffd4
Parents: 2466863
Author: oreissig <or...@gmail.com>
Authored: Thu Feb 4 21:22:43 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:33 2016 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/039b3e56/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 21c3ae3..bc149ba 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -4410,7 +4410,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * to the specified closure condition.
      *
      * See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
-     * containing items which don't match some criteria while leaving the original collection unchanged.
+     * containing items which match some criteria but leaving the original collection unchanged.
      *
      * @param  self a Collection to be modified
      * @param  condition a closure condition
@@ -4443,7 +4443,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * assert map == [a:1]</pre>
      *
      * See also <code>findAll</code> when wanting to produce a new map containing items
-     * which don't match some criteria while leaving the original map unchanged.
+     * which match some criteria but leaving the original map unchanged.
      *
      * @param self a Map to be modified
      * @param condition a 1 or 2 arg Closure condition applying on the entries


[6/7] groovy git commit: implement Map.retainAll(Closure)

Posted by pa...@apache.org.
implement Map.retainAll(Closure)


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

Branch: refs/heads/master
Commit: 4ad1f68d1bd08d8de074a4854f9b2f6984feb6e7
Parents: 039b3e5
Author: oreissig <or...@gmail.com>
Authored: Thu Feb 4 21:53:41 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:35 2016 +1000

----------------------------------------------------------------------
 .../groovy/runtime/DefaultGroovyMethods.java    | 31 ++++++++++++++++++++
 src/test/groovy/MapTest.groovy                  | 20 +++++++++++++
 2 files changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/4ad1f68d/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 bc149ba..c7dd01d 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -4406,6 +4406,37 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     }
 
     /**
+     * Modifies this map so that it retains only its elements that are matched
+     * according to the specified closure condition.  In other words, removes from
+     * this map all of its elements that don't match.
+     *
+     * <pre class="groovyTestCase">def map = [a:1, b:2]
+     * map.retainAll { k,v -> k == 'b' }
+     * assert map == [b:2]</pre>
+     *
+     * See also <code>findAll</code> when wanting to produce a new map containing items
+     * which match some criteria but leaving the original map unchanged.
+     *
+     * @param self a Map to be modified
+     * @param condition a 1 or 2 arg Closure condition applying on the entries
+     * @return <tt>true</tt> if this map changed as a result of the call
+     * @since 2.5
+     */
+    public static <K, V> boolean retainAll(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure condition) {
+        Iterator<Map.Entry<K, V>> iter = self.entrySet().iterator();
+        BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
+        boolean result = false;
+        while (iter.hasNext()) {
+            Map.Entry<K, V> entry = iter.next();
+            if (!bcw.callForMap(entry)) {
+                iter.remove();
+                result = true;
+            }
+        }
+        return result;
+    }
+
+    /**
      * Modifies this collection by removing the elements that are matched according
      * to the specified closure condition.
      *

http://git-wip-us.apache.org/repos/asf/groovy/blob/4ad1f68d/src/test/groovy/MapTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/MapTest.groovy b/src/test/groovy/MapTest.groovy
index 545fa14..d0bbf3d 100644
--- a/src/test/groovy/MapTest.groovy
+++ b/src/test/groovy/MapTest.groovy
@@ -166,6 +166,26 @@ class MapTest extends GroovyTestCase {
         assert map2 == [d:4]
     }
 
+    void testRetainAll() {
+        // given:
+        def map1 = [a:1, b:2]
+        def map2 = [c:3, d:4]
+
+        // when: 'two parameters = key,value'
+        map1.retainAll { k,v ->
+            k == 'a'
+        }
+        // then:
+        assert map1 == [a:1]
+
+        // when: 'one parameter = entry'
+        map2.retainAll { e ->
+            e.value == 3
+        }
+        // then:
+        assert map2 == [c:3]
+    }
+
     void testPlusCollectionMapEntry() {
         def map1 = [a:1, b:2]
         def map2 = [c:3, d:4]


[3/7] groovy git commit: implement Map.removeAll(Closure)

Posted by pa...@apache.org.
implement Map.removeAll(Closure)


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

Branch: refs/heads/master
Commit: 9d33652fd3f73db9ec8f229d72d3784667ff4ebf
Parents: 6981cd1
Author: oreissig <or...@gmail.com>
Authored: Mon Feb 1 20:10:27 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:30 2016 +1000

----------------------------------------------------------------------
 .../groovy/runtime/DefaultGroovyMethods.java    | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9d33652f/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 0a2186f..9f2d38e 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -4433,6 +4433,34 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     }
 
     /**
+     * Modifies this map by removing the elements that are matched according to the
+     * specified closure condition. If the closure takes one parameter then it will be
+     * passed the Map.Entry. Otherwise the closure should take two parameters, which
+     * will be the key and the value.
+     *
+     * See also <code>findAll</code> when wanting to produce a new map containing items
+     * which don't match some criteria while leaving the original map unchanged.
+     *
+     * @param self a Map to be modified
+     * @param condition a 1 or 2 arg Closure condition applying on the entries
+     * @return <tt>true</tt> if this map changed as a result of the call
+     * @since 2.5
+     */
+    public static <K, V> boolean removeAll(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure condition) {
+        Iterator<Map.Entry<K, V>> iter = self.entrySet().iterator();
+        BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
+        boolean result = false;
+        while (iter.hasNext()) {
+            Map.Entry<K, V> entry = iter.next();
+            if (bcw.callForMap(entry)) {
+                iter.remove();
+                result = true;
+            }
+        }
+        return result;
+    }
+
+    /**
      * Modifies the collection by adding all of the elements in the specified array to the collection.
      * The behavior of this operation is undefined if
      * the specified array is modified while the operation is in progress.


[4/7] groovy git commit: add example to javadoc

Posted by pa...@apache.org.
add example to javadoc


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

Branch: refs/heads/master
Commit: 2466863193f74411369335eacc990b5a21d35f71
Parents: 9d33652
Author: oreissig <or...@gmail.com>
Authored: Thu Feb 4 19:50:31 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:32 2016 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/24668631/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 9f2d38e..21c3ae3 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -4437,6 +4437,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * specified closure condition. If the closure takes one parameter then it will be
      * passed the Map.Entry. Otherwise the closure should take two parameters, which
      * will be the key and the value.
+     * 
+     * <pre class="groovyTestCase">def map = [a:1, b:2]
+     * map.removeAll { k,v -> k == 'b' }
+     * assert map == [a:1]</pre>
      *
      * See also <code>findAll</code> when wanting to produce a new map containing items
      * which don't match some criteria while leaving the original map unchanged.


[2/7] groovy git commit: add test case for Map.removeAll { }

Posted by pa...@apache.org.
add test case for Map.removeAll { }


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

Branch: refs/heads/master
Commit: 6981cd1d196c1348398842e0b166db0907d6ceef
Parents: 28777a3
Author: oreissig <or...@gmail.com>
Authored: Mon Feb 1 20:03:24 2016 +0100
Committer: paulk <pa...@asert.com.au>
Committed: Fri Feb 5 11:20:28 2016 +1000

----------------------------------------------------------------------
 src/test/groovy/MapTest.groovy | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6981cd1d/src/test/groovy/MapTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/MapTest.groovy b/src/test/groovy/MapTest.groovy
index e97a10f..545fa14 100644
--- a/src/test/groovy/MapTest.groovy
+++ b/src/test/groovy/MapTest.groovy
@@ -146,6 +146,26 @@ class MapTest extends GroovyTestCase {
         assert map1 == control
     }
 
+    void testRemoveAll() {
+        // given:
+        def map1 = [a:1, b:2]
+        def map2 = [c:3, d:4]
+
+        // when: 'two parameters = key,value'
+        map1.removeAll { k,v ->
+            k == 'a'
+        }
+        // then:
+        assert map1 == [b:2]
+
+        // when: 'one parameter = entry'
+        map2.removeAll { e ->
+            e.value == 3
+        }
+        // then:
+        assert map2 == [d:4]
+    }
+
     void testPlusCollectionMapEntry() {
         def map1 = [a:1, b:2]
         def map2 = [c:3, d:4]