diff --git a/build.gradle b/build.gradle
index 8f0a3e29706..e047e6d07a9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,8 +3,8 @@ plugins {
id 'io.spring.nohttp' version '0.0.10'
id "io.freefair.aspectj" version '6.4.0' apply false
id 'org.jetbrains.dokka' version '1.6.0' apply false
- id 'org.jetbrains.kotlin.jvm' version '1.6.10' apply false
- id "org.jetbrains.kotlin.plugin.serialization" version '1.6.10' apply false
+ id 'org.jetbrains.kotlin.jvm' version '1.6.20-M1' apply false
+ id "org.jetbrains.kotlin.plugin.serialization" version '1.6.20-M1' apply false
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id "org.unbroken-dome.xjc" version '2.0.0' apply false
@@ -33,7 +33,7 @@ configure(allprojects) { project ->
mavenBom "io.r2dbc:r2dbc-bom:Borca-RELEASE"
mavenBom "io.rsocket:rsocket-bom:1.1.1"
mavenBom "org.eclipse.jetty:jetty-bom:11.0.7"
- mavenBom "org.jetbrains.kotlin:kotlin-bom:1.6.10"
+ mavenBom "org.jetbrains.kotlin:kotlin-bom:1.6.20-M1"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.0"
mavenBom "org.jetbrains.kotlinx:kotlinx-serialization-bom:1.3.2"
mavenBom "org.junit:junit-bom:5.8.2"
@@ -277,13 +277,13 @@ configure([rootProject] + javaProjects) { project ->
kotlinOptions {
languageVersion = "1.6"
apiVersion = "1.6"
- freeCompilerArgs = ["-Xjsr305=strict", "-Xsuppress-version-warnings", "-Xopt-in=kotlin.RequiresOptIn"]
+ freeCompilerArgs = ["-Xjsr305=strict", "-Xsuppress-version-warnings", "-opt-in=kotlin.RequiresOptIn"]
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
- freeCompilerArgs = ["-Xjsr305=strict"]
+ freeCompilerArgs = ["-Xjsr305=strict", "-opt-in=kotlin.RequiresOptIn"]
}
}
}
diff --git a/gradle/toolchains.gradle b/gradle/toolchains.gradle
index 302504cabc7..b0bf0af0334 100644
--- a/gradle/toolchains.gradle
+++ b/gradle/toolchains.gradle
@@ -5,10 +5,10 @@
* One can choose the toolchain to use for compiling the MAIN sources and/or compiling
* and running the TEST sources. These options apply to Java, Kotlin and Groovy sources
* when available.
- * {@code "./gradlew check -PmainToolchain=8 -PtestToolchain=11"} will use:
+ * {@code "./gradlew check -PmainToolchain=17 -PtestToolchain=18"} will use:
*
- * - a JDK8 toolchain for compiling the main SourceSet
- *
- a JDK11 toolchain for compiling and running the test SourceSet
+ *
- a JDK17 toolchain for compiling the main SourceSet
+ *
- a JDK18 toolchain for compiling and running the test SourceSet
*
*
* By default, the build will fall back to using the current JDK and 17 language level for all sourceSets.
@@ -21,11 +21,11 @@
*
* We can also configure ENV variables and let Gradle know about them:
* {@code
- * $ echo JDK11
- * /opt/openjdk/java11
- * $ echo JDK15
- * /opt/openjdk/java15
- * $ ./gradlew -Porg.gradle.java.installations.fromEnv=JDK11,JDK15 check
+ * $ echo JDK17
+ * /opt/openjdk/java17
+ * $ echo JDK18
+ * /opt/openjdk/java18
+ * $ ./gradlew -Porg.gradle.java.installations.fromEnv=JDK17,JDK18 check
* }
*
* @author Brian Clozel
@@ -121,12 +121,12 @@ pluginManager.withPlugin("kotlin") {
// Fallback to JDK17
compileKotlin {
kotlinOptions {
- jvmTarget = '1.8'
+ jvmTarget = '17'
}
}
compileTestKotlin {
kotlinOptions {
- jvmTarget = '1.8'
+ jvmTarget = '17'
}
}
}
@@ -137,10 +137,9 @@ pluginManager.withPlugin("kotlin") {
languageVersion = testLanguageVersion
}
// See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm
- def javaVersion = testLanguageVersion.toString() == '8' ? '1.8' : testLanguageVersion.toString()
compileTestKotlin {
kotlinOptions {
- jvmTarget = javaVersion
+ jvmTarget = testLanguageVersion.toString()
jdkHome = compiler.get().metadata.installationPath.asFile.absolutePath
}
}
diff --git a/spring-core/src/test/kotlin/org/springframework/core/KotlinReactiveAdapterRegistryTests.kt b/spring-core/src/test/kotlin/org/springframework/core/KotlinReactiveAdapterRegistryTests.kt
index b58a236bf5a..d74b6e20e7d 100644
--- a/spring-core/src/test/kotlin/org/springframework/core/KotlinReactiveAdapterRegistryTests.kt
+++ b/spring-core/src/test/kotlin/org/springframework/core/KotlinReactiveAdapterRegistryTests.kt
@@ -17,6 +17,7 @@
package org.springframework.core
import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.Flow
@@ -32,6 +33,7 @@ import reactor.test.StepVerifier
import java.time.Duration
import kotlin.reflect.KClass
+@OptIn(DelicateCoroutinesApi::class)
class KotlinReactiveAdapterRegistryTests {
private val registry = ReactiveAdapterRegistry.getSharedInstance()
diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt
index 7a43168c7b3..a1f6fa9a32d 100644
--- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt
+++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt
@@ -17,6 +17,7 @@
package org.springframework.web.reactive.result.method.annotation
import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
@@ -115,6 +116,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
@ComponentScan(resourcePattern = "**/CoroutinesIntegrationTests*")
open class WebConfig
+ @OptIn(DelicateCoroutinesApi::class)
@RestController
class CoroutinesController {