Skip to content

Commit a94db03

Browse files
committed
Target Java 21
Eclair now targets Java 21 and will require a compatible Java Runtime Environment. It will no longer work on JRE 11 and JRE 17.
1 parent 485207f commit a94db03

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

.github/workflows/latest-bitcoind.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ jobs:
3838
with:
3939
path: eclair
4040

41-
- name: Set up JDK 11
41+
- name: Set up JDK 21
4242
uses: actions/setup-java@v3
4343
with:
44-
java-version: 11
44+
java-version: 21
4545
distribution: 'adopt'
4646

4747
- name: Configure OS settings

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ rpcclienttimeout=30
9494

9595
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.
9696

97-
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).
97+
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).
9898

9999
Then download our latest [release](https://github.com/ACINQ/eclair/releases), unzip the archive and run the following command:
100100

docs/release-notes/eclair-vnext.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
<insert changes>
88

9+
### Eclair requires a Java 21 runtime
10+
11+
Eclair now targets Java 21 and requires a compatible Java Runtime Environment. It will no longer work on JRE 11 or JRE 17.
12+
913
### API changes
1014

1115
<insert changes>

eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,11 @@ object NodeAddress {
491491
}
492492

493493
object IPAddress {
494-
def apply(inetAddress: InetAddress, port: Int): IPAddress = inetAddress match {
494+
def apply(inetAddress: InetAddress, port: Int): IPAddress = (inetAddress: @unchecked) match {
495+
// 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)
496+
// with JDK21 InetAddress is defined as `public sealed class InetAddress implements Serializable permits Inet4Address, Inet6Address` and scalac complains because in theory there could be
497+
// an InetAddress() instance, though its not possible in practice because the constructor is package private :(
498+
// remove @unchecked if we upgrade to a newer JDK that does not have this pb, or if scalac pattern matching becomes more clever
495499
case address: Inet4Address => IPv4(address, port)
496500
case address: Inet6Address => IPv6(address, port)
497501
}

eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
package fr.acinq.eclair
1818

1919
import java.io.File
20-
import java.net.{JarURLConnection, URL, URLClassLoader}
21-
20+
import java.net.{JarURLConnection, URI, URL, URLClassLoader}
2221
import akka.http.scaladsl.server.Route
2322
import fr.acinq.eclair.api.directives.EclairDirectives
2423
import grizzled.slf4j.Logging
@@ -59,7 +58,7 @@ object Plugin extends Logging {
5958
}
6059

6160
def openJar(jar: File): Option[JarURLConnection] =
62-
Try(new URL(s"jar:file:${jar.getCanonicalPath}!/").openConnection().asInstanceOf[JarURLConnection]) match {
61+
Try(URI.create(s"jar:file:${jar.getCanonicalPath}!/").toURL.openConnection().asInstanceOf[JarURLConnection]) match {
6362
case Success(url) => Some(url)
6463
case Failure(t) => logger.error(s"unable to load plugin file:${jar.getAbsolutePath} ", t); None
6564
}

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
<properties>
6666
<project.build.outputTimestamp>2020-01-01T00:00:00Z</project.build.outputTimestamp>
6767
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
68-
<maven.compiler.source>11</maven.compiler.source>
69-
<maven.compiler.target>11</maven.compiler.target>
68+
<maven.compiler.release>21</maven.compiler.release>
7069
<scala.version>2.13.11</scala.version>
7170
<scala.version.short>2.13</scala.version.short>
7271
<akka.version>2.6.20</akka.version>
@@ -151,6 +150,7 @@
151150
<arg>-Werror</arg>
152151
<arg>-unchecked</arg>
153152
<arg>-deprecation</arg>
153+
<arg>-release:21</arg>
154154
</args>
155155
<jvmArgs>
156156
<jvmArg>-Xmx1024m</jvmArg>

0 commit comments

Comments
 (0)