Skip to content

Commit

Permalink
Target Java 21
Browse files Browse the repository at this point in the history
Eclair now targets Java 21 and will require a compatible Java Runtime Environment.
It will no longer work on JRE 11 and JRE 17.
  • Loading branch information
sstone committed Dec 10, 2024
1 parent 485207f commit a94db03
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/latest-bitcoind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/eclair-vnext.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

<insert changes>

### 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

<insert changes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,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)
}
Expand Down
5 changes: 2 additions & 3 deletions eclair-node/src/main/scala/fr/acinq/eclair/Plugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
<properties>
<project.build.outputTimestamp>2020-01-01T00:00:00Z</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>21</maven.compiler.release>
<scala.version>2.13.11</scala.version>
<scala.version.short>2.13</scala.version.short>
<akka.version>2.6.20</akka.version>
Expand Down Expand Up @@ -151,6 +150,7 @@
<arg>-Werror</arg>
<arg>-unchecked</arg>
<arg>-deprecation</arg>
<arg>-release:21</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx1024m</jvmArg>
Expand Down

0 comments on commit a94db03

Please sign in to comment.