You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2017/07/18 01:48:55 UTC

[3/6] groovy git commit: GROOVY-8251: rename withAutoCloseable to withCloseable

GROOVY-8251: rename withAutoCloseable to withCloseable

AutoCloseables and Closeables should both be handled consistently.
Naming the method withCloseable is general enough to handle both
cases without requiring distinct naming.


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

Branch: refs/heads/master
Commit: b9541f92c57a2f6e86eb4e634ab216464c42ce08
Parents: daee97c
Author: John Wagenleitner <jw...@apache.org>
Authored: Sun Jul 16 11:03:12 2017 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Mon Jul 17 18:45:24 2017 -0700

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java      | 2 +-
 .../org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b9541f92/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
index 789e0fd..f33d377 100644
--- a/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
@@ -1633,7 +1633,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws Exception if an Exception occurs.
      * @since 2.5.0
      */
-    public static <T, U extends AutoCloseable> T withAutoCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws Exception {
+    public static <T, U extends AutoCloseable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws Exception {
         Throwable thrown = null;
         try {
             return action.call(self);

http://git-wip-us.apache.org/repos/asf/groovy/blob/b9541f92/src/test/org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy b/src/test/org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy
index c5b42d2..e7baa43 100644
--- a/src/test/org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/IOGroovyMethodsTest.groovy
@@ -25,7 +25,7 @@ class IOGroovyMethodsTest extends GroovyTestCase {
     void testWithAutoCloseable() {
         def closeable = new DummyAutoCloseable()
         def closeableParam = null
-        def result = closeable.withAutoCloseable {
+        def result = closeable.withCloseable {
             closeableParam = it
             123
         }
@@ -37,7 +37,7 @@ class IOGroovyMethodsTest extends GroovyTestCase {
     void testWithAutoCloseableDoesNotSuppressException() {
         def closeable = new DummyAutoCloseable(new Exception('close exception'))
         def throwable = GroovyAssert.shouldFail(UnsupportedOperationException) {
-            closeable.withAutoCloseable {
+            closeable.withCloseable {
                 throw new UnsupportedOperationException('not a close exception')
             }
         }
@@ -50,7 +50,7 @@ class IOGroovyMethodsTest extends GroovyTestCase {
         def closeable = new DummyAutoCloseable(new Exception('close exception'))
         def result = null
         def message = shouldFail(Exception) {
-            closeable.withAutoCloseable {
+            closeable.withCloseable {
                 result = 123
             }
         }