From 7035c0fa0a10c30016976e08a49c26f0d379ed86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 12 Dec 2024 17:47:24 +0100 Subject: [PATCH] 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 --- .gitignore | 1 + buildSrc/build.gradle | 1 - .../boot/build/KotlinConventions.java | 22 +++--- gradle.properties | 2 +- .../spring-boot-dependencies/build.gradle | 16 +---- .../spring-boot-docs/build.gradle | 6 ++ .../reference/pages/features/kotlin.adoc | 2 +- .../data/nosql/cassandra/connecting/User.kt | 19 ++++++ .../usingannotatedtypes/Server.kt | 23 +++++++ .../CacheCompletelyBrokenException.kt | 19 ++++++ .../MyContainers.kt | 20 ++++++ .../MyContainersConfiguration.kt | 3 +- .../nestedconfigurationproperties/Nested.kt | 20 ++++++ .../multipleconstructors/AccountService.kt | 20 ++++++ .../multipleconstructors/RiskAssessor.kt | 20 ++++++ .../singleconstructor/AccountService.kt | 20 ++++++ .../singleconstructor/RiskAssessor.kt | 20 ++++++ .../AnotherConfiguration.kt | 19 ++++++ .../SomeConfiguration.kt | 19 ++++++ .../springmvc/errorhandling/MyErrorBody.kt | 19 ++++++ .../springmvc/errorhandling/MyException.kt | 19 ++++++ .../springmvc/errorhandling/SomeController.kt | 19 ++++++ .../SomeController.kt | 19 ++++++ .../spring-boot-gradle-plugin/build.gradle | 1 - .../gradle/plugin/KotlinPluginAction.java | 4 +- .../gradle/junit/GradleMultiDslExtension.java | 6 +- .../KotlinPluginActionIntegrationTests.java | 4 +- .../testkit/PluginClasspathGradleBuild.java | 68 ++++++++++++------- ...anOverrideDefaultJavaParametersFlag.gradle | 8 ++- ...TasksUseJavaParametersFlagByDefault.gradle | 4 +- 30 files changed, 374 insertions(+), 69 deletions(-) create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/cassandra/connecting/User.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/externalconfig/typesafeconfigurationproperties/usingannotatedtypes/Server.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/CacheCompletelyBrokenException.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/packaging/nativeimage/advanced/nestedconfigurationproperties/Nested.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/AccountService.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/RiskAssessor.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/AccountService.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/RiskAssessor.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/AnotherConfiguration.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/SomeConfiguration.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyErrorBody.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyException.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/SomeController.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/errorpageswithoutspringmvc/SomeController.kt diff --git a/.gitignore b/.gitignore index 1198c2da87..d5e93a54c6 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ secrets.yml .sts4-cache .git-hooks/ node_modules +/.kotlin/ diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 1fa9d1e229..b8e4f56fe1 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -42,7 +42,6 @@ dependencies { implementation("org.apache.maven:maven-artifact:${mavenVersion}") implementation("org.antora:gradle-antora-plugin:1.0.0") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlinVersion}") implementation("org.springframework:spring-context") implementation("org.springframework:spring-core") implementation("org.springframework:spring-web") diff --git a/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java index 32b38af396..e59d4e2eba 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,15 @@ package org.springframework.boot.build; import java.net.URI; -import java.util.ArrayList; -import java.util.List; import dev.adamko.dokkatoo.DokkatooExtension; import dev.adamko.dokkatoo.formats.DokkatooHtmlPlugin; import org.gradle.api.Project; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions; +import org.jetbrains.kotlin.gradle.dsl.JvmTarget; +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions; +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion; import org.jetbrains.kotlin.gradle.tasks.KotlinCompile; /** @@ -56,14 +56,12 @@ class KotlinConventions { } private void configure(KotlinCompile compile) { - KotlinJvmOptions kotlinOptions = compile.getKotlinOptions(); - kotlinOptions.setApiVersion("1.7"); - kotlinOptions.setLanguageVersion("1.7"); - kotlinOptions.setJvmTarget("17"); - kotlinOptions.setAllWarningsAsErrors(true); - List freeCompilerArgs = new ArrayList<>(kotlinOptions.getFreeCompilerArgs()); - freeCompilerArgs.add("-Xsuppress-version-warnings"); - kotlinOptions.setFreeCompilerArgs(freeCompilerArgs); + KotlinJvmCompilerOptions compilerOptions = compile.getCompilerOptions(); + compilerOptions.getApiVersion().set(KotlinVersion.KOTLIN_2_1); + compilerOptions.getLanguageVersion().set(KotlinVersion.KOTLIN_2_1); + compilerOptions.getJvmTarget().set(JvmTarget.JVM_17); + compilerOptions.getAllWarningsAsErrors().set(true); + compilerOptions.getFreeCompilerArgs().addAll("-Xsuppress-version-warnings"); } private void configureDokkatoo(Project project) { diff --git a/gradle.properties b/gradle.properties index 655afb5946..856aaca8bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ hamcrestVersion=3.0 jacksonVersion=2.18.4 javaFormatVersion=0.0.43 junitJupiterVersion=5.12.2 -kotlinVersion=1.9.25 +kotlinVersion=2.1.0 mavenVersion=3.9.4 mockitoVersion=5.17.0 nativeBuildToolsVersion=0.10.6 diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index bf50335d88..94daa02496 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1174,10 +1174,6 @@ bom { } } library("Kotlin", "${kotlinVersion}") { - prohibit { - versionRange "[2.0.0-Beta1,)" - because "it exceeds our baseline" - } group("org.jetbrains.kotlin") { bom("kotlin-bom") plugins = [ @@ -1190,11 +1186,7 @@ bom { releaseNotes("https://github.com/JetBrains/kotlin/releases/tag/v{version}") } } - library("Kotlin Coroutines", "1.8.1") { - prohibit { - versionRange "[1.9.0-RC,)" - because "it requires Kotlin 2" - } + library("Kotlin Coroutines", "1.10.1") { group("org.jetbrains.kotlinx") { bom("kotlinx-coroutines-bom") } @@ -1203,11 +1195,7 @@ bom { releaseNotes("https://github.com/Kotlin/kotlinx.coroutines/releases/tag/{version}") } } - library("Kotlin Serialization", "1.6.3") { - prohibit { - versionRange "[1.7.0-RC,)" - because "it requires Kotlin 2" - } + library("Kotlin Serialization", "1.8.0") { group("org.jetbrains.kotlinx") { bom("kotlinx-serialization-bom") } diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 98d4eb5246..f2e221b018 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import org.springframework.boot.build.docs.ConfigureJavadocLinks plugins { @@ -46,6 +47,11 @@ sourcesJar { enabled = false } +// To avoid a redeclaration error with Kotlin compiler +tasks.named('compileKotlin', KotlinCompilationTask.class) { + javaSources.from = [] +} + plugins.withType(EclipsePlugin) { eclipse.classpath { classpath -> classpath.plusConfigurations.add(configurations.getByName(sourceSets.main.runtimeClasspathConfigurationName)) diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc index 386903075b..fdbf0c1748 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc @@ -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. diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/cassandra/connecting/User.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/cassandra/connecting/User.kt new file mode 100644 index 0000000000..44bb6d2665 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/data/nosql/cassandra/connecting/User.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.data.nosql.cassandra.connecting + +class User diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/externalconfig/typesafeconfigurationproperties/usingannotatedtypes/Server.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/externalconfig/typesafeconfigurationproperties/usingannotatedtypes/Server.kt new file mode 100644 index 0000000000..531b1673e5 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/externalconfig/typesafeconfigurationproperties/usingannotatedtypes/Server.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.usingannotatedtypes + +class Server(remoteAddress: Any?) { + fun start() { + + } +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/CacheCompletelyBrokenException.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/CacheCompletelyBrokenException.kt new file mode 100644 index 0000000000..af9d08188c --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/springapplication/applicationavailability/managing/CacheCompletelyBrokenException.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.features.springapplication.applicationavailability.managing + +class CacheCompletelyBrokenException: RuntimeException() \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.kt new file mode 100644 index 0000000000..00accc529a --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations + +class MyContainers { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt index 9c1776c0a4..813d0388b6 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations -import org.springframework.boot.docs.features.devservices.testcontainers.atdevelopmenttime.importingcontainerdeclarations.MyContainers import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.testcontainers.context.ImportTestcontainers diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/packaging/nativeimage/advanced/nestedconfigurationproperties/Nested.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/packaging/nativeimage/advanced/nestedconfigurationproperties/Nested.kt new file mode 100644 index 0000000000..eb05cd77f0 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/packaging/nativeimage/advanced/nestedconfigurationproperties/Nested.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties + +class Nested { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/AccountService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/AccountService.kt new file mode 100644 index 0000000000..26eb0e3f52 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/AccountService.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.springbeansanddependencyinjection.multipleconstructors + +interface AccountService { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/RiskAssessor.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/RiskAssessor.kt new file mode 100644 index 0000000000..a74c763191 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/multipleconstructors/RiskAssessor.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.springbeansanddependencyinjection.multipleconstructors + +interface RiskAssessor { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/AccountService.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/AccountService.kt new file mode 100644 index 0000000000..c68b911ee5 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/AccountService.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.springbeansanddependencyinjection.singleconstructor + +interface AccountService { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/RiskAssessor.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/RiskAssessor.kt new file mode 100644 index 0000000000..2778983f52 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/springbeansanddependencyinjection/singleconstructor/RiskAssessor.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.springbeansanddependencyinjection.singleconstructor + +interface RiskAssessor { +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/AnotherConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/AnotherConfiguration.kt new file mode 100644 index 0000000000..4a541ab9db --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/AnotherConfiguration.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.usingthespringbootapplicationannotation.individualannotations + +class AnotherConfiguration \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/SomeConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/SomeConfiguration.kt new file mode 100644 index 0000000000..8ab987f6ee --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/individualannotations/SomeConfiguration.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.using.usingthespringbootapplicationannotation.individualannotations + +class SomeConfiguration \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyErrorBody.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyErrorBody.kt new file mode 100644 index 0000000000..52116a7f9b --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyErrorBody.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.web.servlet.springmvc.errorhandling + +class MyErrorBody(value: Int, message: String?) \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyException.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyException.kt new file mode 100644 index 0000000000..e01f2fa734 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/MyException.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.web.servlet.springmvc.errorhandling + +class MyException: RuntimeException() \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/SomeController.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/SomeController.kt new file mode 100644 index 0000000000..7b6ccadae1 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/SomeController.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.web.servlet.springmvc.errorhandling + +class SomeController \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/errorpageswithoutspringmvc/SomeController.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/errorpageswithoutspringmvc/SomeController.kt new file mode 100644 index 0000000000..2410284185 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/errorpageswithoutspringmvc/SomeController.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.web.servlet.springmvc.errorhandling.errorpageswithoutspringmvc + +class SomeController \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index d88b8402a4..0995887fab 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -54,7 +54,6 @@ dependencies { testImplementation("org.assertj:assertj-core") testImplementation("org.graalvm.buildtools:native-gradle-plugin") testImplementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion") testImplementation("org.jetbrains.kotlin:kotlin-compiler-runner:$kotlinVersion") testImplementation("org.jetbrains.kotlin:kotlin-daemon-client:$kotlinVersion") testImplementation("org.junit.jupiter:junit-jupiter") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/KotlinPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/KotlinPluginAction.java index afb5eefac1..30ce7061e2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/KotlinPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/KotlinPluginAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ class KotlinPluginAction implements PluginApplicationAction { private void enableJavaParametersOption(Project project) { project.getTasks() .withType(KotlinCompile.class) - .configureEach((compile) -> compile.getKotlinOptions().setJavaParameters(true)); + .configureEach((compile) -> compile.getCompilerOptions().getJavaParameters().set(true)); } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleMultiDslExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleMultiDslExtension.java index 7683e044fe..67c9c7f066 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleMultiDslExtension.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleMultiDslExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ import org.springframework.boot.gradle.testkit.PluginClasspathGradleBuild; import org.springframework.boot.testsupport.gradle.testkit.Dsl; import org.springframework.boot.testsupport.gradle.testkit.GradleBuild; import org.springframework.boot.testsupport.gradle.testkit.GradleBuildExtension; -import org.springframework.boot.testsupport.gradle.testkit.GradleVersions; /** * {@link Extension} that runs {@link TestTemplate templated tests} against the Groovy and @@ -61,8 +60,7 @@ public class GradleMultiDslExtension implements TestTemplateInvocationContextPro @Override public List getAdditionalExtensions() { - GradleBuild gradleBuild = new PluginClasspathGradleBuild(this.dsl) - .gradleVersion(GradleVersions.minimumCompatible()); + GradleBuild gradleBuild = new PluginClasspathGradleBuild(this.dsl); return Arrays.asList(new GradleBuildFieldSetter(gradleBuild), new GradleBuildExtension()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java index ebc3a9cc5b..e2fd064074 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(GradleBuildExtension.class) class KotlinPluginActionIntegrationTests { - GradleBuild gradleBuild = new PluginClasspathGradleBuild(); + GradleBuild gradleBuild = new PluginClasspathGradleBuild().kotlin(); @Test void noKotlinVersionPropertyWithoutKotlinPlugin() { @@ -87,7 +87,7 @@ class KotlinPluginActionIntegrationTests { configured.add(line.substring("Configuring :".length())); } } - assertThat(configured).containsExactlyInAnyOrder("help", "compileJava", "clean"); + assertThat(configured).containsExactlyInAnyOrder("help", "clean"); } private void expectConfigurationCacheRequestedDeprecationWarning() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java index 14d1700b43..f4c14f2d3d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java @@ -18,7 +18,7 @@ package org.springframework.boot.gradle.testkit; import java.io.File; import java.io.IOException; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonView; @@ -55,6 +55,8 @@ import org.springframework.boot.testsupport.gradle.testkit.GradleBuild; */ public class PluginClasspathGradleBuild extends GradleBuild { + private boolean kotlin = false; + public PluginClasspathGradleBuild() { super(); } @@ -63,35 +65,53 @@ public class PluginClasspathGradleBuild extends GradleBuild { super(dsl); } + public PluginClasspathGradleBuild kotlin() { + this.kotlin = true; + return this; + } + @Override public GradleRunner prepareRunner(String... arguments) throws IOException { return super.prepareRunner(arguments).withPluginClasspath(pluginClasspath()); } private List pluginClasspath() { - return Arrays.asList(new File("bin/main"), new File("build/classes/java/main"), - new File("build/resources/main"), new File(pathOfJarContaining(LaunchScript.class)), - new File(pathOfJarContaining(ClassVisitor.class)), - new File(pathOfJarContaining(DependencyManagementPlugin.class)), - new File(pathOfJarContaining("org.jetbrains.kotlin.cli.common.PropertiesKt")), - new File(pathOfJarContaining(KotlinPlatformJvmPlugin.class)), - new File(pathOfJarContaining(KotlinProject.class)), - new File(pathOfJarContaining(KotlinToolingVersion.class)), - new File(pathOfJarContaining("org.jetbrains.kotlin.daemon.client.KotlinCompilerClient")), - new File(pathOfJarContaining(KotlinCompilerPluginSupportPlugin.class)), - new File(pathOfJarContaining(LanguageSettings.class)), - new File(pathOfJarContaining(ArchiveEntry.class)), new File(pathOfJarContaining(BuildRequest.class)), - new File(pathOfJarContaining(HttpClientConnectionManager.class)), - new File(pathOfJarContaining(HttpRequest.class)), - new File(pathOfJarContaining(HttpVersionPolicy.class)), new File(pathOfJarContaining(Module.class)), - new File(pathOfJarContaining(Versioned.class)), - new File(pathOfJarContaining(ParameterNamesModule.class)), - new File(pathOfJarContaining("com.github.openjson.JSONObject")), - new File(pathOfJarContaining(JsonView.class)), new File(pathOfJarContaining(Platform.class)), - new File(pathOfJarContaining(Toml.class)), new File(pathOfJarContaining(Lexer.class)), - new File(pathOfJarContaining("org.graalvm.buildtools.gradle.NativeImagePlugin")), - new File(pathOfJarContaining("org.graalvm.reachability.GraalVMReachabilityMetadataRepository")), - new File(pathOfJarContaining("org.graalvm.buildtools.utils.SharedConstants"))); + List classpath = new ArrayList<>(); + classpath.add(new File("bin/main")); + classpath.add(new File("build/classes/java/main")); + classpath.add(new File("build/resources/main")); + classpath.add(new File(pathOfJarContaining(LaunchScript.class))); + classpath.add(new File(pathOfJarContaining(ClassVisitor.class))); + classpath.add(new File(pathOfJarContaining(DependencyManagementPlugin.class))); + if (this.kotlin) { + classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.cli.common.PropertiesKt"))); + classpath.add(new File(pathOfJarContaining(KotlinPlatformJvmPlugin.class))); + classpath.add(new File(pathOfJarContaining(KotlinProject.class))); + classpath.add(new File(pathOfJarContaining(KotlinToolingVersion.class))); + classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.build.report.metrics.BuildTime"))); + classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.buildtools.api.CompilationService"))); + classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.daemon.client.KotlinCompilerClient"))); + classpath.add(new File(pathOfJarContaining("org.jetbrains.kotlin.konan.library.KonanLibrary"))); + classpath.add(new File(pathOfJarContaining(KotlinCompilerPluginSupportPlugin.class))); + classpath.add(new File(pathOfJarContaining(LanguageSettings.class))); + } + classpath.add(new File(pathOfJarContaining(ArchiveEntry.class))); + classpath.add(new File(pathOfJarContaining(BuildRequest.class))); + classpath.add(new File(pathOfJarContaining(HttpClientConnectionManager.class))); + classpath.add(new File(pathOfJarContaining(HttpRequest.class))); + classpath.add(new File(pathOfJarContaining(HttpVersionPolicy.class))); + classpath.add(new File(pathOfJarContaining(Module.class))); + classpath.add(new File(pathOfJarContaining(Versioned.class))); + classpath.add(new File(pathOfJarContaining(ParameterNamesModule.class))); + classpath.add(new File(pathOfJarContaining("com.github.openjson.JSONObject"))); + classpath.add(new File(pathOfJarContaining(JsonView.class))); + classpath.add(new File(pathOfJarContaining(Platform.class))); + classpath.add(new File(pathOfJarContaining(Toml.class))); + classpath.add(new File(pathOfJarContaining(Lexer.class))); + classpath.add(new File(pathOfJarContaining("org.graalvm.buildtools.gradle.NativeImagePlugin"))); + classpath.add(new File(pathOfJarContaining("org.graalvm.reachability.GraalVMReachabilityMetadataRepository"))); + classpath.add(new File(pathOfJarContaining("org.graalvm.buildtools.utils.SharedConstants"))); + return classpath; } private String pathOfJarContaining(String className) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksCanOverrideDefaultJavaParametersFlag.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksCanOverrideDefaultJavaParametersFlag.gradle index 625f97ccd4..48bf87f114 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksCanOverrideDefaultJavaParametersFlag.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksCanOverrideDefaultJavaParametersFlag.gradle @@ -4,16 +4,18 @@ plugins { apply plugin: 'org.jetbrains.kotlin.jvm' -import org.jetbrains.kotlin.gradle.dsl.KotlinCompile +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile tasks.withType(KotlinCompile) { - kotlinOptions.javaParameters = false + compilerOptions { + javaParameters = false + } } task('kotlinCompileTasksJavaParameters') { doFirst { tasks.withType(KotlinCompile) { - println "${name} java parameters: ${kotlinOptions.javaParameters}" + println "${name} java parameters: ${compilerOptions.javaParameters.get()}" } } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksUseJavaParametersFlagByDefault.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksUseJavaParametersFlagByDefault.gradle index f5be02c186..1058b32684 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksUseJavaParametersFlagByDefault.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests-kotlinCompileTasksUseJavaParametersFlagByDefault.gradle @@ -4,12 +4,12 @@ plugins { apply plugin: 'org.jetbrains.kotlin.jvm' -import org.jetbrains.kotlin.gradle.dsl.KotlinCompile +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile task('kotlinCompileTasksJavaParameters') { doFirst { tasks.withType(KotlinCompile) { - println "${name} java parameters: ${kotlinOptions.javaParameters}" + println "${name} java parameters: ${compilerOptions.javaParameters.get()}" } } }