THRIFT-5702 Support Java 8
Client: Java
Patch: Fokko Driesprong
This closes #2785
diff --git a/lib/java/gradle/sourceConfiguration.gradle b/lib/java/gradle/sourceConfiguration.gradle
index e3e143a..30f72cc 100644
--- a/lib/java/gradle/sourceConfiguration.gradle
+++ b/lib/java/gradle/sourceConfiguration.gradle
@@ -39,8 +39,8 @@
options.encoding = 'UTF-8'
options.debug = true
options.deprecation = true
- // the following is to build with Java 11 specifications, even when building with later JDK
- options.release = 11
+ // the following is to build with Java 8 specifications, even when building with later JDK
+ options.release = 8
options.compilerArgs += [
'-Werror',
'-Xlint:deprecation',
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 d4f8fff..224da21 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 0ec8859..cd52e7f 100644
--- a/lib/kotlin/build.gradle.kts
+++ b/lib/kotlin/build.gradle.kts
@@ -36,10 +36,14 @@
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
+ (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
}
}
+tasks.withType<KotlinCompile> {
+ kotlinOptions.jvmTarget = "1.8"
+}
+
tasks {
if (JavaVersion.current().isJava11Compatible) {
ktfmt {