groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 09/09: GROOVY-8647: Split package renaming (groovy-nio)
Date Mon, 13 May 2019 03:53:36 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 5871a71bca4662bf2481b1ef666dddbf4202dff3
Author: Paul King <paulk@asert.com.au>
AuthorDate: Mon May 13 13:46:31 2019 +1000

    GROOVY-8647: Split package renaming (groovy-nio)
---
 build.gradle                                       |   4 +-
 .../runtime/DefaultGroovyMethodsSupport.java       |  47 +++++++++
 .../codehaus/groovy/runtime/IOGroovyMethods.java   |  45 ---------
 .../groovy/runtime/ResourceGroovyMethods.java      |  12 +--
 subprojects/groovy-nio/build.gradle                |  11 +-
 .../{NioGroovyMethods.java => NioExtensions.java}  |  28 ++++--
 .../apache/groovy/nio/runtime/WritablePath.java    |   3 +-
 .../codehaus/groovy/runtime/NioGroovyMethods.java  | 111 +++++++++++++++++++--
 .../org/codehaus/groovy/runtime/WritablePath.java  |   2 +-
 .../nio/extensions/NioExtensionsTest.groovy}       |  14 +--
 10 files changed, 187 insertions(+), 90 deletions(-)

diff --git a/build.gradle b/build.gradle
index 7a67108..0fcd536 100644
--- a/build.gradle
+++ b/build.gradle
@@ -386,7 +386,7 @@ allprojects {
     tasks.withType(JavaCompile) {
         options.encoding = 'UTF-8'
         options.incremental = true
-//        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
 
         if (classpath) {
             classpath = classpath + files(dgmConverter.outputDir)
@@ -407,7 +407,7 @@ allprojects {
     tasks.withType(GroovyCompile) {
         groovyOptions.fork(memoryMaximumSize: groovycMain_mx)
         groovyOptions.encoding = 'UTF-8'
-//        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
         groovyClasspath = files(
                 rootProject.compileJava.classpath,
                 files(project==rootProject?rootProject.bootstrapJar:rootProject.jar)
diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
index 3838fdc..8681b58 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
@@ -25,7 +25,10 @@ import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
 
 import java.io.Closeable;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
 import java.lang.reflect.Array;
+import java.nio.charset.Charset;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -380,4 +383,48 @@ public class DefaultGroovyMethodsSupport {
         }
         return true;
     }
+
+    protected static void writeUTF16BomIfRequired(final Writer writer, final String charset) throws IOException {
+        writeUTF16BomIfRequired(writer, Charset.forName(charset));
+    }
+
+    protected static void writeUTF16BomIfRequired(final Writer writer, final Charset charset) throws IOException {
+        if ("UTF-16BE".equals(charset.name())) {
+            writeUtf16Bom(writer, true);
+        } else if ("UTF-16LE".equals(charset.name())) {
+            writeUtf16Bom(writer, false);
+        }
+    }
+
+    protected static void writeUTF16BomIfRequired(final OutputStream stream, final String charset) throws IOException {
+        writeUTF16BomIfRequired(stream, Charset.forName(charset));
+    }
+
+    protected static void writeUTF16BomIfRequired(final OutputStream stream, final Charset charset) throws IOException {
+        if ("UTF-16BE".equals(charset.name())) {
+            writeUtf16Bom(stream, true);
+        } else if ("UTF-16LE".equals(charset.name())) {
+            writeUtf16Bom(stream, false);
+        }
+    }
+
+    private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {
+        if (bigEndian) {
+            stream.write(-2);  // FE
+            stream.write(-1);  // FF
+        } else {
+            stream.write(-1);  // FF
+            stream.write(-2);  // FE
+        }
+    }
+
+    private static void writeUtf16Bom(Writer writer, boolean bigEndian) throws IOException {
+        if (bigEndian) {
+            writer.write(-2);  // FE
+            writer.write(-1);  // FF
+        } else {
+            writer.write(-1);  // FF
+            writer.write(-2);  // FE
+        }
+    }
 }
diff --git a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
index 5a9754e..ede9e4b 100644
--- a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
@@ -48,7 +48,6 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
-import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.Formatter;
 import java.util.Iterator;
@@ -1654,49 +1653,5 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
         }
     }
 
-    static void writeUTF16BomIfRequired(final Writer writer, final String charset) throws IOException {
-        writeUTF16BomIfRequired(writer, Charset.forName(charset));
-    }
-
-    static void writeUTF16BomIfRequired(final Writer writer, final Charset charset) throws IOException {
-        if ("UTF-16BE".equals(charset.name())) {
-            writeUtf16Bom(writer, true);
-        } else if ("UTF-16LE".equals(charset.name())) {
-            writeUtf16Bom(writer, false);
-        }
-    }
-
-    static void writeUTF16BomIfRequired(final OutputStream stream, final String charset) throws IOException {
-        writeUTF16BomIfRequired(stream, Charset.forName(charset));
-    }
-
-    static void writeUTF16BomIfRequired(final OutputStream stream, final Charset charset) throws IOException {
-        if ("UTF-16BE".equals(charset.name())) {
-            writeUtf16Bom(stream, true);
-        } else if ("UTF-16LE".equals(charset.name())) {
-            writeUtf16Bom(stream, false);
-        }
-    }
-
-    private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {
-        if (bigEndian) {
-            stream.write(-2);  // FE
-            stream.write(-1);  // FF
-        } else {
-            stream.write(-1);  // FF
-            stream.write(-2);  // FE
-        }
-    }
-
-    private static void writeUtf16Bom(Writer writer, boolean bigEndian) throws IOException {
-        if (bigEndian) {
-            writer.write(-2);  // FE
-            writer.write(-1);  // FF
-        } else {
-            writer.write(-1);  // FF
-            writer.write(-2);  // FE
-        }
-    }
-
     private static final int DEFAULT_BUFFER_SIZE = 8192; // 8k
 }
diff --git a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
index 647f47d..70e0e58 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
@@ -855,7 +855,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
         try {
             FileOutputStream out = new FileOutputStream(file);
             if (writeBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             writer = new OutputStreamWriter(out, charset);
             writer.write(text);
@@ -943,7 +943,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !file.exists();
             writer = newWriter(file, true);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, Charset.defaultCharset().name());
+                writeUTF16BomIfRequired(writer, Charset.defaultCharset().name());
             }
             InvokerHelper.write(writer, text);
             writer.flush();
@@ -1032,7 +1032,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !file.exists();
             FileOutputStream out = new FileOutputStream(file, true);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             writer = new OutputStreamWriter(out, charset);
             InvokerHelper.write(writer, text);
@@ -1133,7 +1133,7 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !file.exists();
             writer = newWriter(file, charset, true);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
+                writeUTF16BomIfRequired(writer, charset);
             }
             InvokerHelper.write(writer, text);
             writer.flush();
@@ -1947,13 +1947,13 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport {
         if (append) {
             FileOutputStream stream = new FileOutputStream(file, append);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(stream, charset);
+                writeUTF16BomIfRequired(stream, charset);
             }
             return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
         } else {
             FileOutputStream stream = new FileOutputStream(file);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(stream, charset);
+                writeUTF16BomIfRequired(stream, charset);
             }
             return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
         }
diff --git a/subprojects/groovy-nio/build.gradle b/subprojects/groovy-nio/build.gradle
index 903310e..d12c4f9 100644
--- a/subprojects/groovy-nio/build.gradle
+++ b/subprojects/groovy-nio/build.gradle
@@ -25,16 +25,7 @@ dependencies {
 }
 
 task moduleDescriptor(type: org.codehaus.groovy.gradle.WriteExtensionDescriptorTask) {
-    extensionClasses = 'org.codehaus.groovy.runtime.NioGroovyMethods'
+    extensionClasses = 'org.apache.groovy.nio.extensions.NioExtensions'
 }
 
 compileJava.dependsOn moduleDescriptor
-
-tasks.withType(JavaCompile) {
-        sourceCompatibility = 1.7
-        targetCompatibility = 1.7
-}
-tasks.withType(Javadoc) {
-        options.source = "1.7"
-}
-
diff --git a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioGroovyMethods.java b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
similarity index 98%
rename from subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioGroovyMethods.java
rename to subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
index 947d28c..73efae6 100644
--- a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioGroovyMethods.java
+++ b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.codehaus.groovy.runtime;
+package org.apache.groovy.nio.extensions;
 
 import groovy.io.FileType;
 import groovy.io.FileVisitResult;
@@ -28,6 +28,11 @@ import groovy.transform.stc.ClosureParams;
 import groovy.transform.stc.FromString;
 import groovy.transform.stc.PickFirstResolver;
 import groovy.transform.stc.SimpleType;
+import org.apache.groovy.nio.runtime.WritablePath;
+import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport;
+import org.codehaus.groovy.runtime.IOGroovyMethods;
+import org.codehaus.groovy.runtime.InvokerHelper;
 import org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker;
 import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
 
@@ -80,8 +85,7 @@ import static org.codehaus.groovy.runtime.DefaultGroovyMethods.get;
  * remove or move a method call in this file but would normally
  * aim to keep the method available from within Groovy.
  */
-
-public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
+public class NioExtensions extends DefaultGroovyMethodsSupport {
 
     /**
      * Provide the standard Groovy <code>size()</code> method for <code>Path</code>.
@@ -553,7 +557,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
         try {
             OutputStream out = Files.newOutputStream(self);
             if (writeBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             writer = new OutputStreamWriter(out, Charset.forName(charset));
             writer.write(text);
@@ -697,7 +701,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !self.toFile().exists();
             OutputStream out = Files.newOutputStream(self, CREATE, APPEND);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, resolvedCharset);
+                writeUTF16BomIfRequired(out, resolvedCharset);
             }
             writer = new OutputStreamWriter(out, resolvedCharset);
             InvokerHelper.write(writer, text);
@@ -815,7 +819,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !file.toFile().exists();
             writer = newWriter(file, charset, true);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
+                writeUTF16BomIfRequired(writer, charset);
             }
             InvokerHelper.write(writer, text);
             writer.flush();
@@ -985,7 +989,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      *                which can be used to control subsequent processing
      * @throws java.io.FileNotFoundException if the given directory does not exist
      * @throws IllegalArgumentException      if the provided Path object does not represent a directory or illegal filter combinations are supplied
-     * @see DefaultGroovyMethods#sort(java.util.Collection, groovy.lang.Closure)
+     * @see DefaultGroovyMethods#sort(java.lang.Iterable, groovy.lang.Closure)
      * @see groovy.io.FileVisitResult
      * @see groovy.io.FileType
      * @since 2.3.0
@@ -1482,7 +1486,8 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
-    public static Object withOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException {
+    @SuppressWarnings("unchecked")
+    public static <T> T withOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newOutputStream(self), closure);
     }
 
@@ -1497,7 +1502,8 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
-    public static Object withInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException {
+    @SuppressWarnings("unchecked")
+    public static <T> T withInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newInputStream(self), closure);
     }
 
@@ -1593,13 +1599,13 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
         if (append) {
             BufferedWriter writer = Files.newBufferedWriter(self, Charset.forName(charset), CREATE, APPEND);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
+                writeUTF16BomIfRequired(writer, charset);
             }
             return writer;
         } else {
             OutputStream out = Files.newOutputStream(self);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             return new BufferedWriter(new OutputStreamWriter(out, Charset.forName(charset)));
         }
diff --git a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
index 4fd7e41..eec9705 100644
--- a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
+++ b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.codehaus.groovy.runtime;
+package org.apache.groovy.nio.runtime;
 
 import groovy.lang.Writable;
 
@@ -39,7 +39,6 @@ import java.util.Iterator;
 /**
  * A Writable Path.
  */
-
 public class WritablePath implements Path, Writable {
 
     private final String encoding;
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 947d28c..52e7b45 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
@@ -80,7 +80,7 @@ import static org.codehaus.groovy.runtime.DefaultGroovyMethods.get;
  * remove or move a method call in this file but would normally
  * aim to keep the method available from within Groovy.
  */
-
+@Deprecated
 public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
 
     /**
@@ -90,6 +90,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return the file's size (length)
      * @since 2.3.0
      */
+    @Deprecated
     public static long size(Path self) throws IOException {
         return Files.size(self);
     }
@@ -102,6 +103,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static ObjectOutputStream newObjectOutputStream(Path self) throws IOException {
         return new ObjectOutputStream(Files.newOutputStream(self));
     }
@@ -118,6 +120,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withObjectOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectOutputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newObjectOutputStream(self), closure);
     }
@@ -130,6 +133,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static ObjectInputStream newObjectInputStream(Path self) throws IOException {
         return new ObjectInputStream(Files.newInputStream(self));
     }
@@ -143,6 +147,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static ObjectInputStream newObjectInputStream(Path self, final ClassLoader classLoader) throws IOException {
         return IOGroovyMethods.newObjectInputStream(Files.newInputStream(self), classLoader);
     }
@@ -157,6 +162,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#eachObject(java.io.ObjectInputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachObject(Path self, Closure closure) throws IOException, ClassNotFoundException {
         IOGroovyMethods.eachObject(newObjectInputStream(self), closure);
     }
@@ -172,6 +178,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withObjectInputStream(Path path, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newObjectInputStream(path), closure);
     }
@@ -188,6 +195,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withObjectInputStream(Path self, ClassLoader classLoader, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newObjectInputStream(self, classLoader), closure);
     }
@@ -204,6 +212,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachLine(Path, int, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T eachLine(Path self, @ClosureParams(value = FromString.class, options = {"String", "String,Integer"}) Closure<T> closure) throws IOException {
         return eachLine(self, 1, closure);
     }
@@ -221,6 +230,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachLine(Path, String, int, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T eachLine(Path self, String charset, @ClosureParams(value = FromString.class, options = {"String", "String,Integer"}) Closure<T> closure) throws IOException {
         return eachLine(self, charset, 1, closure);
     }
@@ -238,6 +248,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#eachLine(java.io.Reader, int, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T eachLine(Path self, int firstLine, @ClosureParams(value = FromString.class, options = {"String", "String,Integer"}) Closure<T> closure) throws IOException {
         return IOGroovyMethods.eachLine(newReader(self), firstLine, closure);
     }
@@ -256,6 +267,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#eachLine(java.io.Reader, int, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T eachLine(Path self, String charset, int firstLine, @ClosureParams(value = FromString.class, options = {"String", "String,Integer"}) Closure<T> closure) throws IOException {
         return IOGroovyMethods.eachLine(newReader(self, charset), firstLine, closure);
     }
@@ -276,6 +288,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, String, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     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);
     }
@@ -295,6 +308,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
      */
+    @Deprecated
     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);
     }
@@ -316,6 +330,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#splitEachLine(java.io.Reader, String, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     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);
     }
@@ -336,6 +351,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
      */
+    @Deprecated
     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);
     }
@@ -349,6 +365,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#readLines(java.io.Reader)
      * @since 2.3.0
      */
+    @Deprecated
     public static List<String> readLines(Path self) throws IOException {
         return IOGroovyMethods.readLines(newReader(self));
     }
@@ -363,6 +380,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#readLines(java.io.Reader)
      * @since 2.3.0
      */
+    @Deprecated
     public static List<String> readLines(Path self, String charset) throws IOException {
         return IOGroovyMethods.readLines(newReader(self, charset));
     }
@@ -377,6 +395,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static String getText(Path self, String charset) throws IOException {
         return IOGroovyMethods.getText(newReader(self, charset));
     }
@@ -389,6 +408,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static String getText(Path self) throws IOException {
         return IOGroovyMethods.getText(newReader(self));
     }
@@ -401,6 +421,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static byte[] getBytes(Path self) throws IOException {
         return IOGroovyMethods.getBytes(Files.newInputStream(self));
     }
@@ -413,6 +434,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void setBytes(Path self, byte[] bytes) throws IOException {
         IOGroovyMethods.setBytes(Files.newOutputStream(self), bytes);
     }
@@ -425,6 +447,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void write(Path self, String text) throws IOException {
         write(self, text, false);
     }
@@ -441,6 +464,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void write(Path self, String text, boolean writeBom) throws IOException {
         write(self, text, Charset.defaultCharset().name(), writeBom);
     }
@@ -454,6 +478,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #write(Path, String)
      * @since 2.3.0
      */
+    @Deprecated
     public static void setText(Path self, String text) throws IOException {
         write(self, text);
     }
@@ -476,6 +501,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #write(Path, String, String)
      * @since 2.3.0
      */
+    @Deprecated
     public static void setText(Path self, String text, String charset) throws IOException {
         write(self, text, charset);
     }
@@ -489,6 +515,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static Path leftShift(Path self, Object text) throws IOException {
         append(self, text);
         return self;
@@ -503,6 +530,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static Path leftShift(Path self, byte[] bytes) throws IOException {
         append(self, bytes);
         return self;
@@ -517,6 +545,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static Path leftShift(Path path, InputStream data) throws IOException {
         append(path, data);
         return path;
@@ -531,6 +560,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void write(Path self, String text, String charset) throws IOException {
         write(self, text, charset, false);
     }
@@ -548,12 +578,13 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void write(Path self, String text, String charset, boolean writeBom) throws IOException {
         Writer writer = null;
         try {
             OutputStream out = Files.newOutputStream(self);
             if (writeBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             writer = new OutputStreamWriter(out, Charset.forName(charset));
             writer.write(text);
@@ -575,6 +606,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path self, Object text) throws IOException {
         append(self, text, Charset.defaultCharset().name(), false);
     }
@@ -588,6 +620,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path file, Reader reader) throws IOException {
         append(file, reader, Charset.defaultCharset().name());
     }
@@ -600,6 +633,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path file, Writer writer) throws IOException {
         append(file, writer, Charset.defaultCharset().name());
     }
@@ -613,6 +647,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path self, byte[] bytes) throws IOException {
         OutputStream stream = null;
         try {
@@ -637,6 +672,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path self, InputStream stream) throws IOException {
         OutputStream out = Files.newOutputStream(self, CREATE, APPEND);
         try {
@@ -658,6 +694,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path self, Object text, boolean writeBom) throws IOException {
         append(self, text, Charset.defaultCharset().name(), writeBom);
     }
@@ -672,6 +709,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path self, Object text, String charset) throws IOException {
         append(self, text, charset, false);
     }
@@ -690,6 +728,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path self, Object text, String charset, boolean writeBom) throws IOException {
         Writer writer = null;
         try {
@@ -697,7 +736,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !self.toFile().exists();
             OutputStream out = Files.newOutputStream(self, CREATE, APPEND);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, resolvedCharset);
+                writeUTF16BomIfRequired(out, resolvedCharset);
             }
             writer = new OutputStreamWriter(out, resolvedCharset);
             InvokerHelper.write(writer, text);
@@ -724,6 +763,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path file, Writer writer, boolean writeBom) throws IOException {
         append(file, writer, Charset.defaultCharset().name(), writeBom);
     }
@@ -738,6 +778,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path file, Writer writer, String charset) throws IOException {
         appendBuffered(file, writer, charset, false);
     }
@@ -756,6 +797,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path file, Writer writer, String charset, boolean writeBom) throws IOException {
         appendBuffered(file, writer, charset, writeBom);
     }
@@ -773,6 +815,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path file, Reader reader, boolean writeBom) throws IOException {
         appendBuffered(file, reader, Charset.defaultCharset().name(), writeBom);
     }
@@ -787,6 +830,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static void append(Path file, Reader reader, String charset) throws IOException {
         append(file, reader, charset, false);
     }
@@ -805,6 +849,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static void append(Path file, Reader reader, String charset, boolean writeBom) throws IOException {
         appendBuffered(file, reader, charset, writeBom);
     }
@@ -815,7 +860,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
             boolean shouldWriteBom = writeBom && !file.toFile().exists();
             writer = newWriter(file, charset, true);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
+                writeUTF16BomIfRequired(writer, charset);
             }
             InvokerHelper.write(writer, text);
             writer.flush();
@@ -856,6 +901,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IllegalArgumentException      if the provided Path object does not represent a directory
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFile(final Path self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException {
         //throws FileNotFoundException, IllegalArgumentException {
         checkDir(self);
@@ -883,6 +929,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFile(Path, groovy.io.FileType, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFile(final Path self, final Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
         eachFile(self, FileType.ANY, closure);
     }
@@ -898,6 +945,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFile(Path, groovy.io.FileType, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachDir(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
         eachFile(self, FileType.DIRECTORIES, closure);
     }
@@ -916,6 +964,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IllegalArgumentException      if the provided Path object does not represent a directory
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFileRecurse(final Path self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
         // throws FileNotFoundException, IllegalArgumentException {
         checkDir(self);
@@ -990,6 +1039,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see groovy.io.FileType
      * @since 2.3.0
      */
+    @Deprecated
     public static void traverse(final Path self, final Map<String, Object> options, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure)
             throws IOException {
         // throws FileNotFoundException, IllegalArgumentException {
@@ -1068,6 +1118,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #traverse(Path, java.util.Map, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void traverse(final Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure)
             throws IOException {
         traverse(self, new HashMap<String, Object>(), closure);
@@ -1086,6 +1137,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #traverse(Path, java.util.Map, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void traverse(final Path self, final Map<String, Object> options)
             throws IOException {
         final Closure visit = (Closure) options.remove("visit");
@@ -1166,6 +1218,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFileRecurse(Path, groovy.io.FileType, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFileRecurse(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException {
         eachFileRecurse(self, FileType.ANY, closure);
     }
@@ -1183,6 +1236,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFileRecurse(Path, groovy.io.FileType, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachDirRecurse(final Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException { //throws FileNotFoundException, IllegalArgumentException {
         eachFileRecurse(self, FileType.DIRECTORIES, closure);
     }
@@ -1215,6 +1269,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws IllegalArgumentException      if the provided Path object does not represent a directory
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFileMatch(final Path self, final FileType fileType, final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException {
         // throws FileNotFoundException, IllegalArgumentException {
         checkDir(self);
@@ -1246,6 +1301,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFileMatch(Path, groovy.io.FileType, Object, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachFileMatch(final Path self, final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException {
         // throws FileNotFoundException, IllegalArgumentException {
         eachFileMatch(self, FileType.ANY, nameFilter, closure);
@@ -1265,6 +1321,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see #eachFileMatch(Path, groovy.io.FileType, Object, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachDirMatch(final Path self, final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException {  // throws FileNotFoundException, IllegalArgumentException {
         eachFileMatch(self, FileType.DIRECTORIES, nameFilter, closure);
     }
@@ -1284,6 +1341,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return true if the file doesn't exist or deletion was successful
      * @since 2.3.0
      */
+    @Deprecated
     public static boolean deleteDir(final Path self) {
         if (!Files.exists(self))
             return true;
@@ -1320,6 +1378,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * <code>false</code> otherwise
      * @since 2.3.0
      */
+    @Deprecated
     public static boolean renameTo(final Path self, String newPathName) {
         try {
             Files.move(self, Paths.get(newPathName));
@@ -1338,6 +1397,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * <code>false</code> otherwise
      * @since 2.3.0
      */
+    @Deprecated
     public static boolean renameTo(final Path self, URI newPathName) {
         try {
             Files.move(self, Paths.get(newPathName));
@@ -1354,6 +1414,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return a Path which wraps the input file and which implements Writable
      * @since 2.3.0
      */
+    @Deprecated
     public static Path asWritable(Path self) {
         return new WritablePath(self);
     }
@@ -1368,6 +1429,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.3.0
      */
     @SuppressWarnings("unchecked")
+    @Deprecated
     public static <T> T asType(Path path, Class<T> c) {
         if (c == Writable.class) {
             return (T) asWritable(path);
@@ -1384,6 +1446,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @return Path which wraps the input file and which implements Writable
      * @since 2.3.0
      */
+    @Deprecated
     public static Path asWritable(Path self, String encoding) {
         return new WritablePath(self, encoding);
     }
@@ -1396,6 +1459,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedReader newReader(Path self) throws IOException {
         return Files.newBufferedReader(self, Charset.defaultCharset());
     }
@@ -1411,6 +1475,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.UnsupportedEncodingException if the encoding specified is not supported
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedReader newReader(Path self, String charset) throws IOException {
         return Files.newBufferedReader(self, Charset.forName(charset));
     }
@@ -1426,6 +1491,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withReader(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.Reader") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withReader(newReader(self), closure);
     }
@@ -1443,6 +1509,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withReader(Path self, String charset, @ClosureParams(value = SimpleType.class, options = "java.io.Reader") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withReader(newReader(self, charset), closure);
     }
@@ -1455,6 +1522,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedOutputStream newOutputStream(Path self) throws IOException {
         return new BufferedOutputStream(Files.newOutputStream(self));
     }
@@ -1467,6 +1535,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static DataOutputStream newDataOutputStream(Path self) throws IOException {
         return new DataOutputStream(Files.newOutputStream(self));
     }
@@ -1482,6 +1551,8 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
+    @SuppressWarnings("unchecked")
     public static Object withOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException {
         return IOGroovyMethods.withStream(newOutputStream(self), closure);
     }
@@ -1497,6 +1568,8 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
+    @SuppressWarnings("unchecked")
     public static Object withInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException {
         return IOGroovyMethods.withStream(newInputStream(self), closure);
     }
@@ -1512,6 +1585,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withDataOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.DataOutputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newDataOutputStream(self), closure);
     }
@@ -1527,6 +1601,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withDataInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.DataInputStream") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withStream(newDataInputStream(self), closure);
     }
@@ -1539,6 +1614,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedWriter newWriter(Path self) throws IOException {
         return Files.newBufferedWriter(self, Charset.defaultCharset());
     }
@@ -1553,6 +1629,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedWriter newWriter(Path self, boolean append) throws IOException {
         if (append) {
             return Files.newBufferedWriter(self, Charset.defaultCharset(), CREATE, APPEND);
@@ -1570,6 +1647,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedWriter newWriter(Path self, String charset, boolean append) throws IOException {
         return newWriter(self, charset, append, false);
     }
@@ -1588,18 +1666,19 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static BufferedWriter newWriter(Path self, String charset, boolean append, boolean writeBom) throws IOException {
         boolean shouldWriteBom = writeBom && !self.toFile().exists();
         if (append) {
             BufferedWriter writer = Files.newBufferedWriter(self, Charset.forName(charset), CREATE, APPEND);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
+                writeUTF16BomIfRequired(writer, charset);
             }
             return writer;
         } else {
             OutputStream out = Files.newOutputStream(self);
             if (shouldWriteBom) {
-                IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
+                writeUTF16BomIfRequired(out, charset);
             }
             return new BufferedWriter(new OutputStreamWriter(out, Charset.forName(charset)));
         }
@@ -1615,6 +1694,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedWriter newWriter(Path self, String charset) throws IOException {
         return newWriter(self, charset, false);
     }
@@ -1630,6 +1710,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withWriter(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return withWriter(self, Charset.defaultCharset().name(), closure);
     }
@@ -1646,6 +1727,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withWriter(Path self, String charset, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return withWriter(self, charset, false, closure);
     }
@@ -1666,6 +1748,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static <T> T withWriter(Path self, String charset, boolean writeBom, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withWriter(newWriter(self, charset, false, writeBom), closure);
     }
@@ -1683,6 +1766,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withWriterAppend(Path self, String charset, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return withWriterAppend(self, charset, false, closure);
     }
@@ -1703,6 +1787,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.5.0
      */
+    @Deprecated
     public static <T> T withWriterAppend(Path self, String charset, boolean writeBom, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withWriter(newWriter(self, charset, true, writeBom), closure);
     }
@@ -1718,6 +1803,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withWriterAppend(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException {
         return withWriterAppend(self, Charset.defaultCharset().name(), closure);
     }
@@ -1730,6 +1816,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static PrintWriter newPrintWriter(Path self) throws IOException {
         return new GroovyPrintWriter(newWriter(self));
     }
@@ -1744,6 +1831,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static PrintWriter newPrintWriter(Path self, String charset) throws IOException {
         return new GroovyPrintWriter(newWriter(self, charset));
     }
@@ -1759,6 +1847,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withPrintWriter(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.PrintWriter") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withWriter(newPrintWriter(self), closure);
     }
@@ -1775,6 +1864,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static <T> T withPrintWriter(Path self, String charset, @ClosureParams(value = SimpleType.class, options = "java.io.PrintWriter") Closure<T> closure) throws IOException {
         return IOGroovyMethods.withWriter(newPrintWriter(self, charset), closure);
     }
@@ -1787,6 +1877,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.FileNotFoundException if the file is not found.
      * @since 2.3.0
      */
+    @Deprecated
     public static BufferedInputStream newInputStream(Path self) throws IOException { // throws FileNotFoundException {
         return new BufferedInputStream(Files.newInputStream(self));
     }
@@ -1799,6 +1890,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.FileNotFoundException if the file is not found.
      * @since 2.3.0
      */
+    @Deprecated
     public static DataInputStream newDataInputStream(Path self) throws IOException { // throws FileNotFoundException {
         return new DataInputStream(Files.newInputStream(self));
     }
@@ -1812,6 +1904,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#eachByte(java.io.InputStream, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachByte(Path self, @ClosureParams(value = SimpleType.class, options = "byte") Closure closure) throws IOException {
         BufferedInputStream is = newInputStream(self);
         IOGroovyMethods.eachByte(is, closure);
@@ -1827,6 +1920,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#eachByte(java.io.InputStream, int, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void eachByte(Path self, int bufferLen, @ClosureParams(value = FromString.class, options = "byte[],Integer") Closure closure) throws IOException {
         BufferedInputStream is = newInputStream(self);
         IOGroovyMethods.eachByte(is, bufferLen, closure);
@@ -1844,6 +1938,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#filterLine(java.io.Reader, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static Writable filterLine(Path self, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure closure) throws IOException {
         return IOGroovyMethods.filterLine(newReader(self), closure);
     }
@@ -1861,6 +1956,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#filterLine(java.io.Reader, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static Writable filterLine(Path self, String charset, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure closure) throws IOException {
         return IOGroovyMethods.filterLine(newReader(self, charset), closure);
     }
@@ -1877,6 +1973,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#filterLine(java.io.Reader, java.io.Writer, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void filterLine(Path self, Writer writer, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure closure) throws IOException {
         IOGroovyMethods.filterLine(newReader(self), writer, closure);
     }
@@ -1894,6 +1991,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @see org.codehaus.groovy.runtime.IOGroovyMethods#filterLine(java.io.Reader, java.io.Writer, groovy.lang.Closure)
      * @since 2.3.0
      */
+    @Deprecated
     public static void filterLine(Path self, Writer writer, String charset, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure closure) throws IOException {
         IOGroovyMethods.filterLine(newReader(self, charset), writer, closure);
     }
@@ -1906,6 +2004,7 @@ public class NioGroovyMethods extends DefaultGroovyMethodsSupport {
      * @throws java.io.IOException if an IOException occurs.
      * @since 2.3.0
      */
+    @Deprecated
     public static byte[] readBytes(Path self) throws IOException {
         return Files.readAllBytes(self);
     }
diff --git a/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/WritablePath.java b/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/WritablePath.java
index 4fd7e41..56d5e59 100644
--- a/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/WritablePath.java
+++ b/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/WritablePath.java
@@ -39,7 +39,7 @@ import java.util.Iterator;
 /**
  * A Writable Path.
  */
-
+@Deprecated
 public class WritablePath implements Path, Writable {
 
     private final String encoding;
diff --git a/subprojects/groovy-nio/src/test/groovy/org/codehaus/groovy/runtime/NioGroovyMethodsTest.groovy b/subprojects/groovy-nio/src/test/groovy/org/apache/groovy/nio/extensions/NioExtensionsTest.groovy
similarity index 96%
rename from subprojects/groovy-nio/src/test/groovy/org/codehaus/groovy/runtime/NioGroovyMethodsTest.groovy
rename to subprojects/groovy-nio/src/test/groovy/org/apache/groovy/nio/extensions/NioExtensionsTest.groovy
index 1cbc4c2..6404044 100644
--- a/subprojects/groovy-nio/src/test/groovy/org/codehaus/groovy/runtime/NioGroovyMethodsTest.groovy
+++ b/subprojects/groovy-nio/src/test/groovy/org/apache/groovy/nio/extensions/NioExtensionsTest.groovy
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.codehaus.groovy.runtime
+package org.apache.groovy.nio.extensions
 
 import java.nio.file.Files
 import java.nio.file.StandardCopyOption
@@ -26,7 +26,7 @@ import org.junit.Rule
 import org.junit.rules.TemporaryFolder
 import spock.lang.Specification
 
-class NioGroovyMethodsTest extends Specification {
+class NioExtensionsTest extends Specification {
 
     @Rule
     TemporaryFolder temporaryFolder
@@ -121,7 +121,7 @@ class NioGroovyMethodsTest extends Specification {
         path.append(' ؁', encoding, true)
 
         then:
-        byte[] bytes = NioGroovyMethods.getBytes(path)
+        byte[] bytes = NioExtensions.getBytes(path)
         bytes[0] == -1 as byte
         bytes[1] == -2 as byte
         String string = path.getText(encoding)
@@ -138,7 +138,7 @@ class NioGroovyMethodsTest extends Specification {
         path.append(reader, encoding, true)
 
         then:
-        byte[] bytes = NioGroovyMethods.getBytes(path)
+        byte[] bytes = NioExtensions.getBytes(path)
         bytes[0] == -1 as byte
         bytes[1] == -2 as byte
         String string = path.getText(encoding)
@@ -157,7 +157,7 @@ class NioGroovyMethodsTest extends Specification {
         path.append(writer, encoding, true)
 
         then:
-        byte[] bytes = NioGroovyMethods.getBytes(path)
+        byte[] bytes = NioExtensions.getBytes(path)
         bytes[0] == -1 as byte
         bytes[1] == -2 as byte
         String string = path.getText(encoding)
@@ -513,7 +513,7 @@ class NioGroovyMethodsTest extends Specification {
         path.write(str, 'UTF-16LE', true)
 
         then:
-        assert NioGroovyMethods.getBytes(path) == [-1, -2, 72, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 119, 0, 111, 0, 114, 0, 108, 0, 100, 0, 33, 0] as byte[]
+        assert NioExtensions.getBytes(path) == [-1, -2, 72, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 119, 0, 111, 0, 114, 0, 108, 0, 100, 0, 33, 0] as byte[]
     }
 
     def testWriteUTF16BE() {
@@ -537,7 +537,7 @@ class NioGroovyMethodsTest extends Specification {
         path.write(str, 'UTF-16BE', true)
 
         then:
-        assert NioGroovyMethods.getBytes(path) == [-2, -1, 0, 72, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 119, 0, 111, 0, 114, 0, 108, 0, 100, 0, 33] as byte[]
+        assert NioExtensions.getBytes(path) == [-2, -1, 0, 72, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 119, 0, 111, 0, 114, 0, 108, 0, 100, 0, 33] as byte[]
     }
 
 }


Mime
View raw message