Skip to content

Commit ba9bef6

Browse files
committed
Upgrade to Kotlin 2.2.0
Kotlin 2.2 is the new baseline for Spring Framework 7.0. -Xannotation-default-target=param-property is specified to avoid warnings when compiling tests or documentation snippets. It is expected to become the default behavior in an upcoming version of Kotlin, see https://youtrack.jetbrains.com/issue/KT-73255 for more details. Closes gh-34453
1 parent fee873d commit ba9bef6

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

buildSrc/src/main/java/org/springframework/build/KotlinConventions.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ void apply(Project project) {
3434

3535
private void configure(KotlinCompile compile) {
3636
compile.compilerOptions(options -> {
37-
options.getApiVersion().set(KotlinVersion.KOTLIN_2_1);
38-
options.getLanguageVersion().set(KotlinVersion.KOTLIN_2_1);
37+
options.getApiVersion().set(KotlinVersion.KOTLIN_2_2);
38+
options.getLanguageVersion().set(KotlinVersion.KOTLIN_2_2);
3939
options.getJvmTarget().set(JvmTarget.JVM_17);
4040
options.getJavaParameters().set(true);
4141
options.getAllWarningsAsErrors().set(true);
4242
options.getFreeCompilerArgs().addAll(
4343
"-Xsuppress-version-warnings",
4444
"-Xjsr305=strict", // For dependencies using JSR 305
4545
"-opt-in=kotlin.RequiresOptIn",
46-
"-Xjdk-release=17" // Needed due to https://youtrack.jetbrains.com/issue/KT-49746
46+
"-Xjdk-release=17", // Needed due to https://youtrack.jetbrains.com/issue/KT-49746
47+
"-Xannotation-default-target=param-property" // Upcoming default, see https://youtrack.jetbrains.com/issue/KT-73255
4748
);
4849
});
4950
}

framework-docs/framework-docs.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ repositories {
4646
// To avoid a redeclaration error with Kotlin compiler
4747
tasks.named('compileKotlin', KotlinCompilationTask.class) {
4848
javaSources.from = []
49+
compilerOptions.freeCompilerArgs = [ "-Xannotation-default-target=param-property" ] // Upcoming default, see https://youtrack.jetbrains.com/issue/KT-73255
4950
}
5051

5152
dependencies {

framework-docs/modules/ROOT/pages/languages/kotlin/requirements.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
= Requirements
33
:page-section-summary-toc: 1
44

5-
Spring Framework supports Kotlin 2.1+ and requires
5+
Spring Framework supports Kotlin 2.2+ and requires
66
https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-stdlib[`kotlin-stdlib`]
77
and https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-reflect[`kotlin-reflect`]
88
to be present on the classpath. They are provided by default if you bootstrap a Kotlin project on

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ org.gradle.caching=true
44
org.gradle.jvmargs=-Xmx2048m
55
org.gradle.parallel=true
66

7-
kotlinVersion=2.2.0-RC2
7+
kotlinVersion=2.2.0
88

99
kotlin.jvm.target.validation.mode=ignore
1010
kotlin.stdlib.default.dependency=false

0 commit comments

Comments
 (0)