cushon commented on issue #285:
URL: https://github.com/apache/mina-sshd/issues/285#issuecomment-1345600920

   I'm still seeing a compilation error:
   
   ```
   $ mvn clean package -Djava.sdk.version=19
   ...
   [ERROR] 
/usr/local/google/home/cushon/src/mina-sshd/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java:[37,18]
 close() in org.apache.sshd.common.util.threads.CloseableExecutorService 
clashes with close() in java.util.concurrent.ExecutorService
   [ERROR]   overridden method does not throw java.io.IOException
   ```
   
   One option might be to rethrow as `UncheckedIOException` to avoid the clash:
   
   ```diff
   diff --git 
a/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
 
b/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
   index cc7a81b9..3f4bf77d 100644
   --- 
a/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
   +++ 
b/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
   @@ -20,6 +20,7 @@
    package org.apache.sshd.common.util.threads;
   
    import java.io.IOException;
   +import java.io.UncheckedIOException;
    import java.time.Duration;
    import java.util.Objects;
    import java.util.concurrent.ExecutorService;
   @@ -34,7 +35,11 @@ public interface CloseableExecutorService extends 
ExecutorService, Closeable {
        }
   
        @Override
   -    default void close() throws IOException {
   -        Closeable.super.close();
   +    default void close() {
   +        try {
   +            Closeable.super.close();
   +        } catch (IOException e) {
   +            throw new UncheckedIOException(e);
   +        }
        }
    }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to