diff --git a/.github/workflows/latest-bitcoind.yml b/.github/workflows/latest-bitcoind.yml index 26ea8ad60c..3ad462e1f1 100644 --- a/.github/workflows/latest-bitcoind.yml +++ b/.github/workflows/latest-bitcoind.yml @@ -38,10 +38,10 @@ jobs: with: path: eclair - - name: Set up JDK 11 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 21 distribution: 'adopt' - name: Configure OS settings diff --git a/README.md b/README.md index 416ccb54f0..caa27cd5bc 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ rpcclienttimeout=30 Eclair is developed in [Scala](https://www.scala-lang.org/), a powerful functional language that runs on the JVM, and is packaged as a ZIP archive. -To run Eclair, you first need to install Java. Eclair targets Java 11 and will run on any compatible Java runtime (including 11, 17 and 21), we recommend that you use [OpenJDK 21](https://adoptium.net/temurin/releases/?package=jdk&version=21). +To run Eclair, you first need to install Java. Eclair targets Java 21 and will run on any compatible Java runtime, we recommend that you use [OpenJDK 21](https://adoptium.net/temurin/releases/?package=jdk&version=21). Then download our latest [release](https://github.com/ACINQ/eclair/releases), unzip the archive and run the following command: diff --git a/docs/release-notes/eclair-vnext.md b/docs/release-notes/eclair-vnext.md index 4f4e013ba1..51de3f060d 100644 --- a/docs/release-notes/eclair-vnext.md +++ b/docs/release-notes/eclair-vnext.md @@ -33,6 +33,10 @@ Existing `static_remote_key` channels will continue to work. You can override th Eclair will not allow remote peers to open new obsolete channels that do not support `option_static_remotekey`. +### Eclair requires a Java 21 runtime + +Eclair now targets Java 21 and requires a compatible Java Runtime Environment. It will no longer work on JRE 11 or JRE 17. + ### API changes - `channelstats` now takes optional parameters `--count` and `--skip` to control pagination. By default, it will return first 10 entries. (#2890) diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala b/eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala index e045da1475..aaaf857045 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala @@ -489,7 +489,11 @@ object NodeAddress { } object IPAddress { - def apply(inetAddress: InetAddress, port: Int): IPAddress = inetAddress match { + def apply(inetAddress: InetAddress, port: Int): IPAddress = (inetAddress: @unchecked) match { + // we need the @unchecked annotation to suppress a "matching not exhaustive". Before JDK21, InetAddress was a regular so scalac would not check anything (it only checks sealed patterns) + // with JDK21 InetAddress is defined as `public sealed class InetAddress implements Serializable permits Inet4Address, Inet6Address` and scalac complains because in theory there could be + // an InetAddress() instance, though its not possible in practice because the constructor is package private :( + // remove @unchecked if we upgrade to a newer JDK that does not have this pb, or if scalac pattern matching becomes more clever case address: Inet4Address => IPv4(address, port) case address: Inet6Address => IPv6(address, port) } diff --git a/eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala b/eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala index d7e4100434..2cc9cffd20 100644 --- a/eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala +++ b/eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala @@ -17,8 +17,7 @@ package fr.acinq.eclair import java.io.File -import java.net.{JarURLConnection, URL, URLClassLoader} - +import java.net.{JarURLConnection, URI, URL, URLClassLoader} import akka.http.scaladsl.server.Route import fr.acinq.eclair.api.directives.EclairDirectives import grizzled.slf4j.Logging @@ -59,7 +58,7 @@ object Plugin extends Logging { } def openJar(jar: File): Option[JarURLConnection] = - Try(new URL(s"jar:file:${jar.getCanonicalPath}!/").openConnection().asInstanceOf[JarURLConnection]) match { + Try(URI.create(s"jar:file:${jar.getCanonicalPath}!/").toURL.openConnection().asInstanceOf[JarURLConnection]) match { case Success(url) => Some(url) case Failure(t) => logger.error(s"unable to load plugin file:${jar.getAbsolutePath} ", t); None } diff --git a/pom.xml b/pom.xml index a5d17439f5..189226634e 100644 --- a/pom.xml +++ b/pom.xml @@ -65,8 +65,7 @@ 2020-01-01T00:00:00Z UTF-8 - 11 - 11 + 21 2.13.11 2.13 2.6.20 @@ -151,6 +150,7 @@ -Werror -unchecked -deprecation + -release:21 -Xmx1024m