Skip to content

Commit 2d84ef8

Browse files
committed
Upgrade to Kotlin 2.2.0
This commit leverages Kotlin 2.2 which is expected to be the new baseline for Spring Boot 4.0, so API and language versions are upgraded to KOTLIN_2_2 as well. It also enables the -Xannotation-default-target=param-property compiler flag, mainly for test purpose, in order to avoid the related warnings and to use what will likely be the default in an upcoming Kotlin version short term. For more details see https://youtrack.jetbrains.com/issue/KT-73255. KotlinPlatformJvmPlugin was a class from an old KMP plugin, deprecated for a long time and now removed. So its usage in PluginClasspathGradleBuild has been removed as well. Signed-off-by: Sébastien Deleuze <[email protected]>
1 parent 5db3cac commit 2d84ef8

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class KotlinConventions {
5454

5555
private static final JvmTarget JVM_TARGET = JvmTarget.JVM_17;
5656

57-
private static final KotlinVersion KOTLIN_VERSION = KotlinVersion.KOTLIN_2_1;
57+
private static final KotlinVersion KOTLIN_VERSION = KotlinVersion.KOTLIN_2_2;
5858

5959
void apply(Project project) {
6060
project.getPlugins().withId("org.jetbrains.kotlin.jvm", (plugin) -> {
@@ -70,7 +70,8 @@ private void configure(KotlinCompile compile) {
7070
compilerOptions.getLanguageVersion().set(KOTLIN_VERSION);
7171
compilerOptions.getJvmTarget().set(JVM_TARGET);
7272
compilerOptions.getAllWarningsAsErrors().set(true);
73-
compilerOptions.getFreeCompilerArgs().addAll("-Xsuppress-version-warnings");
73+
compilerOptions.getFreeCompilerArgs()
74+
.addAll("-Xsuppress-version-warnings", "-Xannotation-default-target=param-property");
7475
}
7576

7677
private void configureDokkatoo(Project project) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ hamcrestVersion=3.0
1414
jacksonVersion=2.19.1
1515
javaFormatVersion=0.0.47
1616
junitJupiterVersion=5.13.1
17-
kotlinVersion=2.1.0
17+
kotlinVersion=2.2.0
1818
mavenVersion=3.9.10
1919
mockitoVersion=5.17.0
2020
nativeBuildToolsVersion=0.10.6

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.gradle.testkit.runner.GradleRunner;
3636
import org.jetbrains.kotlin.gradle.model.KotlinProject;
3737
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin;
38-
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin;
3938
import org.jetbrains.kotlin.project.model.LanguageSettings;
4039
import org.jetbrains.kotlin.tooling.core.KotlinToolingVersion;
4140
import org.tomlj.Toml;
@@ -85,7 +84,6 @@ private List<File> pluginClasspath() {
8584
classpath.add(new File(pathOfJarContaining(DependencyManagementPlugin.class)));
8685
if (this.kotlin) {
8786
classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.cli.common.PropertiesKt")));
88-
classpath.add(new File(pathOfJarContaining(KotlinPlatformJvmPlugin.class)));
8987
classpath.add(new File(pathOfJarContaining(KotlinProject.class)));
9088
classpath.add(new File(pathOfJarContaining(KotlinToolingVersion.class)));
9189
classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.build.report.metrics.BuildTime")));

0 commit comments

Comments
 (0)