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:57:09 UTC
[2/5] 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/b05a7633
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b05a7633
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b05a7633
Branch: refs/heads/GROOVY_2_6_X
Commit: b05a76333c7462c411bdda949261555a2c586b6f
Parents: 3908d13
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:55:15 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/b05a7633/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/b05a7633/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
}
}