You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by pa...@apache.org on 2015/05/31 13:11:35 UTC
incubator-groovy git commit: GROOVY-7440: Improve ClosureParam type
hints for various splitEachLine GroovyMethod methods (closes #25) (closes
#27)
Repository: incubator-groovy
Updated Branches:
refs/heads/master 96b234a92 -> 5b521788c
GROOVY-7440: Improve ClosureParam type hints for various splitEachLine GroovyMethod methods (closes #25) (closes #27)
Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/5b521788
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/5b521788
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/5b521788
Branch: refs/heads/master
Commit: 5b521788c1fe590138d8c6b3d61e87f57cd1d0d5
Parents: 96b234a
Author: Paul King <pa...@asert.com.au>
Authored: Sun May 31 21:11:20 2015 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Sun May 31 21:11:20 2015 +1000
----------------------------------------------------------------------
.../groovy/runtime/IOGroovyMethods.java | 16 +++++++------
.../groovy/runtime/ResourceGroovyMethods.java | 17 +++++++-------
.../groovy/runtime/StringGroovyMethods.java | 8 +++----
src/test/groovy/GroovyClosureMethodsTest.groovy | 13 +++++++++++
.../IOGMClosureParamTypeInferenceSTCTest.groovy | 24 ++++++++++++++++++++
.../groovy/runtime/NioGroovyMethods.java | 9 ++++----
6 files changed, 64 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/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 d57b76a..b7b1587 100644
--- a/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
@@ -25,6 +25,7 @@ import groovy.lang.Writable;
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.FirstParam;
import groovy.transform.stc.FromString;
+import groovy.transform.stc.PickFirstResolver;
import groovy.transform.stc.SimpleType;
import org.codehaus.groovy.runtime.callsite.BooleanClosureWrapper;
@@ -55,6 +56,7 @@ import java.util.Locale;
import java.util.logging.Logger;
import java.util.regex.Pattern;
+import static org.codehaus.groovy.ast.tools.ClosureUtils.hasSingleStringArg;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForLine;
/**
@@ -497,7 +499,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see java.lang.String#split(java.lang.String)
* @since 1.5.5
*/
- public static <T> T splitEachLine(Reader self, String regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Reader self, String regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex), closure);
}
@@ -527,7 +529,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see java.lang.String#split(java.lang.String)
* @since 1.6.8
*/
- public static <T> T splitEachLine(Reader self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Reader self, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
BufferedReader br;
T result = null;
@@ -543,7 +545,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
break;
} else {
List vals = Arrays.asList(pattern.split(line));
- result = closure.call(vals);
+ result = closure.call(hasSingleStringArg(closure) ? vals.get(0) : vals);
}
}
Reader temp = self;
@@ -573,7 +575,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.5.5
*/
- public static <T> T splitEachLine(InputStream stream, String regex, String charset, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(InputStream stream, String regex, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream, charset)), regex, closure);
}
@@ -592,7 +594,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(InputStream stream, Pattern pattern, String charset, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(InputStream stream, Pattern pattern, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream, charset)), pattern, closure);
}
@@ -611,7 +613,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.5.6
*/
- public static <T> T splitEachLine(InputStream stream, String regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(InputStream stream, String regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream)), regex, closure);
}
@@ -628,7 +630,7 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(InputStream stream, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(InputStream stream, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(new BufferedReader(new InputStreamReader(stream)), pattern, closure);
}
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
index 909e112..e390393 100644
--- a/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
@@ -27,6 +27,7 @@ import groovy.lang.MetaClass;
import groovy.lang.Writable;
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.FromString;
+import groovy.transform.stc.PickFirstResolver;
import groovy.transform.stc.SimpleType;
import groovy.util.CharsetToolkit;
@@ -375,7 +376,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.5.5
*/
- public static <T> T splitEachLine(File self, String regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(File self, String regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure);
}
@@ -394,7 +395,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(File self, Pattern pattern, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(File self, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), pattern, closure);
}
@@ -416,7 +417,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(File self, String regex, String charset, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(File self, String regex, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), regex, closure);
}
@@ -436,7 +437,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(File self, Pattern pattern, String charset, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(File self, Pattern pattern, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), pattern, closure);
}
@@ -457,7 +458,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(URL self, String regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(URL self, String regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure);
}
@@ -476,7 +477,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(URL self, Pattern pattern, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(URL self, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), pattern, closure);
}
@@ -498,7 +499,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.lang.String, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(URL self, String regex, String charset, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(URL self, String regex, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), regex, closure);
}
@@ -518,7 +519,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
* @see IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.6.8
*/
- public static <T> T splitEachLine(URL self, Pattern pattern, String charset, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(URL self, Pattern pattern, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), pattern, closure);
}
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
index 4423faf..bd4a76a 100644
--- a/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
@@ -2951,7 +2951,7 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(CharSequence, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.8.2
*/
- public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex.toString()), closure);
}
@@ -2967,7 +2967,7 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport {
* @throws java.io.IOException if an error occurs
* @since 1.8.2
*/
- public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
final List<String> list = readLines(self);
T result = null;
for (String line : list) {
@@ -2982,7 +2982,7 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(CharSequence, java.util.regex.Pattern, groovy.lang.Closure)
*/
@Deprecated
- public static <T> T splitEachLine(String self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(String self, Pattern pattern, Closure<T> closure) throws IOException {
return splitEachLine((CharSequence) self, pattern, closure);
}
@@ -2991,7 +2991,7 @@ public class StringGroovyMethods extends DefaultGroovyMethodsSupport {
* @see #splitEachLine(CharSequence, java.util.regex.Pattern, groovy.lang.Closure)
*/
@Deprecated
- public static <T> T splitEachLine(String self, String regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(String self, String regex, Closure<T> closure) throws IOException {
return splitEachLine((CharSequence) self, (CharSequence) regex, closure);
}
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/src/test/groovy/GroovyClosureMethodsTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/GroovyClosureMethodsTest.groovy b/src/test/groovy/GroovyClosureMethodsTest.groovy
index 5acc24e..43afac4 100644
--- a/src/test/groovy/GroovyClosureMethodsTest.groovy
+++ b/src/test/groovy/GroovyClosureMethodsTest.groovy
@@ -185,6 +185,19 @@ E F G H
assert all_lines == [["A", "B", "C", "D"], ["E", "F", "G", "H"], ["1", "2", "3", "4"]]
}
+ void testSplitEachLineVarArgClosure() {
+ String s = """A B C D
+E F G H
+1 2 3 4
+"""
+ Reader reader = new StringReader(s)
+ def all_lines = []
+ reader.splitEachLine(" ") { a, b, c, d ->
+ all_lines << [a, b, c, d]
+ }
+ assert all_lines == [["A", "B", "C", "D"], ["E", "F", "G", "H"], ["1", "2", "3", "4"]]
+ }
+
void testSplitEachLinePattern() {
String s = """A B C D
E F G H
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/src/test/groovy/transform/stc/IOGMClosureParamTypeInferenceSTCTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/IOGMClosureParamTypeInferenceSTCTest.groovy b/src/test/groovy/transform/stc/IOGMClosureParamTypeInferenceSTCTest.groovy
index b2c568b..a57e44f 100644
--- a/src/test/groovy/transform/stc/IOGMClosureParamTypeInferenceSTCTest.groovy
+++ b/src/test/groovy/transform/stc/IOGMClosureParamTypeInferenceSTCTest.groovy
@@ -193,6 +193,30 @@ d,e,f""".bytes).newReader()
'''
assertScript '''def reader = new ByteArrayInputStream("""a,b,c
d,e,f""".bytes).newReader()
+ reader.splitEachLine(',') { List it -> assert it.size() == 3 }
+ '''
+ assertScript '''def reader = new ByteArrayInputStream("""a,b,c
+d,e,f""".bytes).newReader()
+ reader.splitEachLine(',') { List<String> it -> assert it.size() == 3 }
+ '''
+ assertScript '''def reader = new ByteArrayInputStream("""a,b,c
+d,e,f""".bytes).newReader()
+ reader.splitEachLine(',') { a, b, c -> assert [a.size(), b.size(), c.size()] == [1, 1, 1] }
+// TODO replace above with below once GROOVY-7442 is fixed
+// reader.splitEachLine(',') { a, b, c -> assert [a, b, c]*.size() == [1, 1, 1] }
+ '''
+ assertScript '''def reader = new ByteArrayInputStream("""a,b,c
+d,e,f""".bytes).newReader()
+ reader.splitEachLine(',') { String a, String b, String c -> assert [a.size(), b.size(), c.size()] == [1, 1, 1] }
+// TODO replace above with below once GROOVY-7442 is fixed
+// reader.splitEachLine(',') { String a, String b, String c -> assert [a, b, c]*.size() == [1, 1, 1] }
+ '''
+ assertScript '''def reader = new ByteArrayInputStream("""a,b,c
+d,e,f""".bytes).newReader()
+ reader.splitEachLine(',') { String it -> assert it instanceof String && it.size() == 1 }
+ '''
+ assertScript '''def reader = new ByteArrayInputStream("""a,b,c
+d,e,f""".bytes).newReader()
reader.splitEachLine(~',') { assert it.size() == 3 }
'''
}
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5b521788/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java b/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
index 7469929..c0ad455 100644
--- a/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
+++ b/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
@@ -60,6 +60,7 @@ import groovy.lang.MetaClass;
import groovy.lang.Writable;
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.FromString;
+import groovy.transform.stc.PickFirstResolver;
import groovy.transform.stc.SimpleType;
import org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker;
import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
@@ -304,7 +305,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
* @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, String, groovy.lang.Closure)
* @since 2.3.0
*/
- public static <T> T splitEachLine(Path self, String regex, @ClosureParams(value = FromString.class, options = "List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Path self, String regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), regex, closure);
}
@@ -323,7 +324,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
* @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 2.3.0
*/
- public static <T> T splitEachLine(Path self, Pattern pattern, @ClosureParams(value = FromString.class, options = "List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Path self, Pattern pattern, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self), pattern, closure);
}
@@ -345,7 +346,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
* @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, String, groovy.lang.Closure)
* @since 2.3.0
*/
- public static <T> T splitEachLine(Path self, String regex, String charset, @ClosureParams(value = FromString.class, options = "List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Path self, String regex, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), regex, closure);
}
@@ -365,7 +366,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
* @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, java.util.regex.Pattern, groovy.lang.Closure)
* @since 2.3.0
*/
- public static <T> T splitEachLine(Path self, Pattern pattern, String charset, @ClosureParams(value = FromString.class, options = "List<String>") Closure<T> closure) throws IOException {
+ public static <T> T splitEachLine(Path self, Pattern pattern, String charset, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return IOGroovyMethods.splitEachLine(newReader(self, charset), pattern, closure);
}