You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2022/12/09 19:00:36 UTC

[GitHub] [mina-sshd] cushon opened a new issue, #285: Compilation error due to ExecutorService API change in JDK 19

cushon opened a new issue, #285:
URL: https://github.com/apache/mina-sshd/issues/285

   ### Version
   
   3b16da43563abcfa1225bae1c4ddcf862acf9912
   
   ### Bug description
   
   Starting in JDK 19, `ExecutorService` implements `AutoCloseable`: https://github.com/openjdk/jdk/commit/00e6c63cd12e3f92d0c1d007aab4f74915616ffb#diff-139913957207a1eeaa338c35b269f2c566b358590ae62dd2a8063e98bb5b0456
   
   This change causes a compilation error in mina-sshd.
   
   ### Actual behavior
   
   ```
   cd ~/sshd-common
   mvn clean package -Djava.sdk.version=19
   ...
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sshd-common: Compilation failure: Compilation failure:
   [ERROR] /usr/local/google/home/cushon/src/mina-sshd/sshd-common/src/main/java/org/apache/sshd/common/util/threads/NoCloseExecutor.java:[43,8] org.apache.sshd.common.util.threads.NoCloseExecutor is not abstract and does not override abstract method close() in java.nio.channels.Channel
   [ERROR] /usr/local/google/home/cushon/src/mina-sshd/sshd-common/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java:[29,8] types java.util.concurrent.ExecutorService and org.apache.sshd.common.Closeable are incompatible;
   [ERROR]   interface org.apache.sshd.common.util.threads.CloseableExecutorService inherits unrelated defaults for close() from types java.util.concurrent.ExecutorService and org.apache.sshd.common.Closeable
   [ERROR] /usr/local/google/home/cushon/src/mina-sshd/sshd-common/src/main/java/org/apache/sshd/common/util/threads/SshThreadPoolExecutor.java:[35,8] types org.apache.sshd.common.Closeable and java.util.concurrent.ExecutorService are incompatible;
   [ERROR]   class org.apache.sshd.common.util.threads.SshThreadPoolExecutor inherits unrelated defaults for close() from types org.apache.sshd.common.Closeable and java.util.concurrent.ExecutorService
   [ERROR] -> [Help 1]
   ```
   
   ### Expected behavior
   
   I expected the project to compile
   
   ### Relevant log output
   
   ```Shell
   Apache Maven 3.8.6
   Maven home: /usr/share/maven
   Java version: 19.0.1, vendor: Oracle Corporation
   Default locale: en_US, platform encoding: UTF-8
   OS name: "linux", arch: "amd64", family: "unix"
   ```
   
   
   ### Other information
   
   _No response_


-- 
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-unsubscribe@mina.apache.org.apache.org

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


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


[GitHub] [mina-sshd] cushon commented on issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
cushon commented on issue #285:
URL: https://github.com/apache/mina-sshd/issues/285#issuecomment-1345356864

   The CSR for the change (https://bugs.openjdk.org/browse/JDK-8285450) does at least acknowledge this could happen:
   
   > The introduced methods are in public classes and interfaces for which it is conceivable but highly unlikely that users have clashing existing methods in implementation classes or subclasses
   
   Based on some testing I've been doing with 19 this problem does seem to be very rare.


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] tomaswolf closed issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
tomaswolf closed issue #285: Compilation error due to ExecutorService API change in JDK 19
URL: https://github.com/apache/mina-sshd/issues/285


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] tomaswolf closed issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
tomaswolf closed issue #285: Compilation error due to ExecutorService API change in JDK 19
URL: https://github.com/apache/mina-sshd/issues/285


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] tomaswolf commented on issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
tomaswolf commented on issue #285:
URL: https://github.com/apache/mina-sshd/issues/285#issuecomment-1346015012

   Thank you, Liam!


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] tomaswolf commented on issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
tomaswolf commented on issue #285:
URL: https://github.com/apache/mina-sshd/issues/285#issuecomment-1345639490

   Want to provide a pull request?


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] tomaswolf commented on issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
tomaswolf commented on issue #285:
URL: https://github.com/apache/mina-sshd/issues/285#issuecomment-1345200983

   Ooof. An API break in the JDK that's not even mentioned in the [change notes](https://www.oracle.com/java/technologies/javase/19-relnote-issues.html). (At least I didn't see it there.)
   
   That's going to be "fun" to sort out. It's the kind of fun I could do without.
   
   The immediate issue seems to be that `org.apache.sshd.common.Closeable` has a default method for close(), and now the ExecutorService also does. Additionally `org.apache.sshd.common.Closeable` wrongly extends `java.nio.channels.Channel`. Just having an isOpen() and a close() method doesn't make it a channel.


-- 
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-unsubscribe@mina.apache.org

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


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


[GitHub] [mina-sshd] cushon commented on issue #285: Compilation error due to ExecutorService API change in JDK 19

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@mina.apache.org

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


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