java to use jdk 17 (#2686)
diff --git a/lib/java/README.md b/lib/java/README.md
index cd12932..7005c60 100644
--- a/lib/java/README.md
+++ b/lib/java/README.md
@@ -52,7 +52,7 @@
```bash
export GRADLE_VERSION="7.5.1"
# install dependencies
-apt-get install -y --no-install-recommends openjdk-11-jdk-headless wget unzip
+apt-get install -y --no-install-recommends openjdk-17-jdk-headless wget unzip
# download gradle distribution
wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
# check binary integrity
diff --git a/lib/java/gradle/sourceConfiguration.gradle b/lib/java/gradle/sourceConfiguration.gradle
index 47f4ff0..1d4c44c 100644
--- a/lib/java/gradle/sourceConfiguration.gradle
+++ b/lib/java/gradle/sourceConfiguration.gradle
@@ -21,7 +21,7 @@
// ----------------------------------------------------------------------------
// Compiler configuration details
-// We are using Java 11 toolchain to compile.
+// We are using Java 17 toolchain to compile.
// This enables decoupling from the Java version that gradle runs, from
// the actual JDK version for the project. For more details, see
// https://docs.gradle.org/current/userguide/toolchains.html
@@ -31,7 +31,7 @@
// also a runtime CI that's based on Java 8 to ensure that.
java {
toolchain {
- languageVersion = JavaLanguageVersion.of(11)
+ languageVersion = JavaLanguageVersion.of(17)
}
}
@@ -39,8 +39,8 @@
options.encoding = 'UTF-8'
options.debug = true
options.deprecation = true
- // the following is to build with Java 8 specifications, even when building with JDK9 or later
- options.release = 8
+ // the following is to build with Java 11 specifications, even when building with later JDK
+ options.release = 11
options.compilerArgs += [
'-Werror',
'-Xlint:deprecation',
diff --git a/lib/java/gradle/unitTests.gradle b/lib/java/gradle/unitTests.gradle
index db9ad82..293bcca 100644
--- a/lib/java/gradle/unitTests.gradle
+++ b/lib/java/gradle/unitTests.gradle
@@ -65,6 +65,8 @@
outputs.upToDateWhen { false }
}
+ // This is required for Mockito to run under Java 17
+ jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
include '**/Test*.class'
exclude '**/Test*\$*.class'
diff --git a/lib/java/src/test/java/org/apache/thrift/transport/TestTSaslTransports.java b/lib/java/src/test/java/org/apache/thrift/transport/TestTSaslTransports.java
index 224da21..d4f8fff 100644
--- a/lib/java/src/test/java/org/apache/thrift/transport/TestTSaslTransports.java
+++ b/lib/java/src/test/java/org/apache/thrift/transport/TestTSaslTransports.java
@@ -492,7 +492,7 @@
public static class SaslAnonymousProvider extends java.security.Provider {
public SaslAnonymousProvider() {
- super("ThriftSaslAnonymous", 1.0, "Thrift Anonymous SASL provider");
+ super("ThriftSaslAnonymous", "1.0", "Thrift Anonymous SASL provider");
put("SaslClientFactory.ANONYMOUS", SaslAnonymousFactory.class.getName());
put("SaslServerFactory.ANONYMOUS", SaslAnonymousFactory.class.getName());
}
diff --git a/lib/kotlin/build.gradle.kts b/lib/kotlin/build.gradle.kts
index 90b9e80..06b73f2 100644
--- a/lib/kotlin/build.gradle.kts
+++ b/lib/kotlin/build.gradle.kts
@@ -36,7 +36,7 @@
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
+ (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
}
}
diff --git a/lib/kotlin/cross-test-client/build.gradle.kts b/lib/kotlin/cross-test-client/build.gradle.kts
index ff48eed..579d01e 100644
--- a/lib/kotlin/cross-test-client/build.gradle.kts
+++ b/lib/kotlin/cross-test-client/build.gradle.kts
@@ -52,7 +52,7 @@
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
+ (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
}
}
diff --git a/lib/kotlin/cross-test-server/build.gradle.kts b/lib/kotlin/cross-test-server/build.gradle.kts
index eda1ebd..4f6e12d 100644
--- a/lib/kotlin/cross-test-server/build.gradle.kts
+++ b/lib/kotlin/cross-test-server/build.gradle.kts
@@ -50,7 +50,7 @@
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
+ (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
}
}