Upgrade to Kotlin 2.1.0

This commit upgrades to Kotlin 2.1.0. Two related dependencies have been
updated as well: Kotlin Coroutines to 1.10, and Kotlin Serialization to
1.8.

As of Kotlin 2, it is no longer possible to have a Java type and a
Kotlin type with the same name. As our code samples follow that
unfortunate pattern, this commit makes sure that the Kotlin sample code
does not depend on any of the Java counterpart and configure the kotlin
compilation plugin to ignore Java sources.

The minimum version of Gradle is 7.6.4. It bundles a version of Kotlin
that cannot compile a Kotlin build script when spring-core, compiled
with Kotlin 2.1, is on the classpath. Using Gradle 8.12 to run the DSL
tests avoids the problem.

Closes gh-45486

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
This commit is contained in:
Stéphane Nicoll
2024-12-12 17:47:24 +01:00
committed by Phillip Webb
parent 5ce080f1bb
commit 7035c0fa0a
30 changed files with 374 additions and 69 deletions

View File

@@ -15,7 +15,7 @@ Feel free to join the #spring channel of https://slack.kotlinlang.org/[Kotlin Sl
[[features.kotlin.requirements]]
== Requirements
Spring Boot requires at least Kotlin 1.7.x and manages a suitable Kotlin version through dependency management.
Spring Boot requires at least Kotlin 2.1.x and manages a suitable Kotlin version through dependency management.
To use Kotlin, `org.jetbrains.kotlin:kotlin-stdlib` and `org.jetbrains.kotlin:kotlin-reflect` must be present on the classpath.
The `kotlin-stdlib` variants `kotlin-stdlib-jdk7` and `kotlin-stdlib-jdk8` can also be used.