This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d83117  Add '@SuppressWarnings("unused") // Possibly thrown from 
subclasses' to eliminate compiler warnings.
6d83117 is described below

commit 6d831176b7555438eefaa0757b2d957d88cdc48c
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Thu Jan 28 19:14:31 2021 -0500

    Add '@SuppressWarnings("unused") // Possibly thrown from subclasses' to
    eliminate compiler warnings.
---
 src/main/java/org/apache/commons/io/DirectoryWalker.java   |  9 +++++++++
 .../org/apache/commons/io/input/ObservableInputStream.java | 14 +++++++++-----
 .../java/org/apache/commons/io/input/ProxyInputStream.java |  2 ++
 src/main/java/org/apache/commons/io/input/ProxyReader.java |  2 ++
 .../apache/commons/io/monitor/FileAlterationObserver.java  |  2 ++
 .../apache/commons/io/output/ProxyCollectionWriter.java    |  2 ++
 .../org/apache/commons/io/output/ProxyOutputStream.java    |  2 ++
 .../java/org/apache/commons/io/output/ProxyWriter.java     |  2 ++
 8 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/DirectoryWalker.java 
b/src/main/java/org/apache/commons/io/DirectoryWalker.java
index 4270cf8..f3253f0 100644
--- a/src/main/java/org/apache/commons/io/DirectoryWalker.java
+++ b/src/main/java/org/apache/commons/io/DirectoryWalker.java
@@ -442,6 +442,7 @@ public abstract class DirectoryWalker<T> {
      * @return true if the walk has been cancelled
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected boolean handleIsCancelled(
             final File file, final int depth, final Collection<T> results) 
throws IOException {
         // do nothing - overridable by subclass
@@ -479,6 +480,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleStart(final File startDirectory, final Collection<T> 
results) throws IOException {
         // do nothing - overridable by subclass
     }
@@ -500,6 +502,7 @@ public abstract class DirectoryWalker<T> {
      * @return true to process this directory, false to skip this directory
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected boolean handleDirectory(final File directory, final int depth, 
final Collection<T> results) throws
             IOException {
         // do nothing - overridable by subclass
@@ -517,6 +520,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleDirectoryStart(final File directory, final int depth, 
final Collection<T> results) throws
             IOException {
         // do nothing - overridable by subclass
@@ -535,6 +539,7 @@ public abstract class DirectoryWalker<T> {
      * @throws IOException if an I/O Error occurs
      * @since 2.0
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected File[] filterDirectoryContents(final File directory, final int 
depth, final File... files) throws
             IOException {
         return files;
@@ -551,6 +556,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleFile(final File file, final int depth, final 
Collection<T> results) throws IOException {
         // do nothing - overridable by subclass
     }
@@ -566,6 +572,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleRestricted(final File directory, final int depth, 
final Collection<T> results) throws
             IOException {
         // do nothing - overridable by subclass
@@ -582,6 +589,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleDirectoryEnd(final File directory, final int depth, 
final Collection<T> results) throws
             IOException {
         // do nothing - overridable by subclass
@@ -596,6 +604,7 @@ public abstract class DirectoryWalker<T> {
      * @param results  the collection of result objects, may be updated
      * @throws IOException if an I/O Error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void handleEnd(final Collection<T> results) throws IOException {
         // do nothing - overridable by subclass
     }
diff --git 
a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java 
b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
index f65930c..2343a56 100644
--- a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
@@ -48,8 +48,9 @@ public class ObservableInputStream extends ProxyInputStream {
          * on the {@link ObservableInputStream}, and will return a value.
          * @param pByte The value, which is being returned. This will never be 
-1 (EOF),
          *    because, in that case, {@link #finished()} will be invoked 
instead.
-         * @throws IOException if an I/O error occurs
+         * @throws IOException if an I/O error occurs.
          */
+        @SuppressWarnings("unused") // Possibly thrown from subclasses.
         public void data(final int pByte) throws IOException {
             // noop
         }
@@ -62,8 +63,9 @@ public class ObservableInputStream extends ProxyInputStream {
          *   data has been stored.
          * @param pOffset The offset within the byte array, where data has 
been stored.
          * @param pLength The number of bytes, which have been stored in the 
byte array.
-         * @throws IOException if an I/O error occurs
+         * @throws IOException if an I/O error occurs.
          */
+        @SuppressWarnings("unused") // Possibly thrown from subclasses.
         public void data(final byte[] pBuffer, final int pOffset, final int 
pLength) throws IOException {
             // noop
         }
@@ -73,16 +75,18 @@ public class ObservableInputStream extends ProxyInputStream 
{
          * This method may be called multiple times, if the reader keeps 
invoking
          * either of the read methods, and they will consequently keep 
returning
          * EOF.
-         * @throws IOException if an I/O error occurs
+         * @throws IOException if an I/O error occurs.
          */
+        @SuppressWarnings("unused") // Possibly thrown from subclasses.
         public void finished() throws IOException {
             // noop
         }
 
         /**
          * Called to indicate that the {@link ObservableInputStream} has been 
closed.
-         * @throws IOException if an I/O error occurs
+         * @throws IOException if an I/O error occurs.
          */
+        @SuppressWarnings("unused") // Possibly thrown from subclasses.
         public void closed() throws IOException {
             // noop
         }
@@ -90,7 +94,7 @@ public class ObservableInputStream extends ProxyInputStream {
         /**
          * Called to indicate that an error occurred on the underlying stream.
          * @param pException the exception to throw
-         * @throws IOException if an I/O error occurs
+         * @throws IOException if an I/O error occurs.
          */
         public void error(final IOException pException) throws IOException {
             throw pException;
diff --git a/src/main/java/org/apache/commons/io/input/ProxyInputStream.java 
b/src/main/java/org/apache/commons/io/input/ProxyInputStream.java
index b57a93b..fdea363 100644
--- a/src/main/java/org/apache/commons/io/input/ProxyInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ProxyInputStream.java
@@ -197,6 +197,7 @@ public abstract class ProxyInputStream extends 
FilterInputStream {
      * @param n number of bytes that the caller asked to be read
      * @throws IOException if the pre-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void beforeRead(final int n) throws IOException {
         // no-op
     }
@@ -218,6 +219,7 @@ public abstract class ProxyInputStream extends 
FilterInputStream {
      * @param n number of bytes read, or -1 if the end of stream was reached
      * @throws IOException if the post-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void afterRead(final int n) throws IOException {
         // no-op
     }
diff --git a/src/main/java/org/apache/commons/io/input/ProxyReader.java 
b/src/main/java/org/apache/commons/io/input/ProxyReader.java
index 6f1eb19..8ed16ae 100644
--- a/src/main/java/org/apache/commons/io/input/ProxyReader.java
+++ b/src/main/java/org/apache/commons/io/input/ProxyReader.java
@@ -223,6 +223,7 @@ public abstract class ProxyReader extends FilterReader {
      * @param n number of chars that the caller asked to be read
      * @throws IOException if the pre-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void beforeRead(final int n) throws IOException {
         // noop
     }
@@ -244,6 +245,7 @@ public abstract class ProxyReader extends FilterReader {
      * @param n number of chars read, or -1 if the end of stream was reached
      * @throws IOException if the post-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void afterRead(final int n) throws IOException {
         // noop
     }
diff --git 
a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java 
b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
index 50e86ca..48b96f9 100644
--- a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
+++ b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
@@ -274,6 +274,7 @@ public class FileAlterationObserver implements Serializable 
{
      *
      * @throws Exception if an error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     public void initialize() throws Exception {
         rootEntry.refresh(rootEntry.getFile());
         final FileEntry[] children = doListFiles(rootEntry.getFile(), 
rootEntry);
@@ -285,6 +286,7 @@ public class FileAlterationObserver implements Serializable 
{
      *
      * @throws Exception if an error occurs
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     public void destroy() throws Exception {
         // noop
     }
diff --git 
a/src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java 
b/src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java
index 32dd5a7..91fab36 100644
--- a/src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java
+++ b/src/main/java/org/apache/commons/io/output/ProxyCollectionWriter.java
@@ -64,6 +64,7 @@ public class ProxyCollectionWriter extends 
FilterCollectionWriter {
      * @param n number of chars written
      * @throws IOException if the post-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void afterWrite(final int n) throws IOException {
         // noop
     }
@@ -140,6 +141,7 @@ public class ProxyCollectionWriter extends 
FilterCollectionWriter {
      * @param n number of chars to be written
      * @throws IOException if the pre-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void beforeWrite(final int n) throws IOException {
         // noop
     }
diff --git a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java 
b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
index 5a53920..f3a1119 100644
--- a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
@@ -130,6 +130,7 @@ public class ProxyOutputStream extends FilterOutputStream {
      * @param n number of bytes to be written
      * @throws IOException if the pre-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void beforeWrite(final int n) throws IOException {
         // noop
     }
@@ -148,6 +149,7 @@ public class ProxyOutputStream extends FilterOutputStream {
      * @param n number of bytes written
      * @throws IOException if the post-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void afterWrite(final int n) throws IOException {
         // noop
     }
diff --git a/src/main/java/org/apache/commons/io/output/ProxyWriter.java 
b/src/main/java/org/apache/commons/io/output/ProxyWriter.java
index 54a358a..1d50e97 100644
--- a/src/main/java/org/apache/commons/io/output/ProxyWriter.java
+++ b/src/main/java/org/apache/commons/io/output/ProxyWriter.java
@@ -222,6 +222,7 @@ public class ProxyWriter extends FilterWriter {
      * @param n number of chars to be written
      * @throws IOException if the pre-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void beforeWrite(final int n) throws IOException {
         // noop
     }
@@ -241,6 +242,7 @@ public class ProxyWriter extends FilterWriter {
      * @param n number of chars written
      * @throws IOException if the post-processing fails
      */
+    @SuppressWarnings("unused") // Possibly thrown from subclasses.
     protected void afterWrite(final int n) throws IOException {
         // noop
     }

Reply via email to