You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
See gh-46238
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc
+6-7Lines changed: 6 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,10 @@ Feel free to join the #spring channel of https://slack.kotlinlang.org/[Kotlin Sl
15
15
[[features.kotlin.requirements]]
16
16
== Requirements
17
17
18
-
Spring Boot requires at least Kotlin 2.1.x and manages a suitable Kotlin version through dependency management.
18
+
Spring Boot requires at least Kotlin 2.2.x and manages a suitable Kotlin version through dependency management.
19
19
To use Kotlin, `org.jetbrains.kotlin:kotlin-stdlib` and `org.jetbrains.kotlin:kotlin-reflect` must be present on the classpath.
20
-
The `kotlin-stdlib` variants `kotlin-stdlib-jdk7` and `kotlin-stdlib-jdk8` can also be used.
20
+
21
+
Kotlin 2.2.x introduces https://kotlinlang.org/docs/whatsnew22.html#new-defaulting-rules-for-use-site-annotation-targets[new defaulting rules for propagating annotations to parameters, fields, and properties]. In order to avoid related warnings and use what will likely become the Kotlin default behavior in an upcoming version, it is recommended to configure the `-Xannotation-default-target=param-property` compiler flag.
21
22
22
23
Since https://discuss.kotlinlang.org/t/classes-final-by-default/166[Kotlin classes are final by default], you are likely to want to configure {url-kotlin-docs}/compiler-plugins.html#spring-support[kotlin-spring] plugin in order to automatically open Spring-annotated classes so that they can be proxied.
23
24
@@ -39,15 +40,13 @@ Kotlin also allows using functional constructs with nullable values as described
39
40
40
41
Although Java does not allow one to express null-safety in its type system, Spring Framework, Spring Data, and Reactor now provide null-safety of their API through tooling-friendly annotations.
41
42
By default, types from Java APIs used in Kotlin are recognized as {url-kotlin-docs}/java-interop.html#null-safety-and-platform-types[platform types] for which null-checks are relaxed.
42
-
{url-kotlin-docs}/java-interop.html#jsr-305-support[Kotlin's support for JSR 305 annotations] combined with nullability annotations provide null-safety for the related Spring API in Kotlin.
43
+
{url-kotlin-docs}/java-interop.html#nullability-annotations[Kotlin's support for nullability annotations] provides null-safety for the annotated APIs like Spring's one in Kotlin.
43
44
44
-
The JSR 305 checks can be configured by adding the `-Xjsr305` compiler flag with the following options: `-Xjsr305={strict|warn|ignore}`.
45
+
The https://jspecify.dev[JSpecify] strict checks are https://kotlinlang.org/docs/whatsnew21.html#change-of-jspecify-nullability-mismatch-diagnostics-severity-to-strict[enabled by default], while the JSR 305 checks can be configured by adding the `-Xjsr305` compiler flag with the following options: `-Xjsr305={strict|warn|ignore}`.
45
46
The default behavior is the same as `-Xjsr305=warn`.
46
47
The `strict` value is required to have null-safety taken in account in Kotlin types inferred from Spring API but should be used with the knowledge that Spring API nullability declaration could evolve even between minor releases and more checks may be added in the future).
47
48
48
-
WARNING: Generic type arguments, varargs and array elements nullability are not yet supported.
49
-
See https://jira.spring.io/browse/SPR-15942[SPR-15942] for up-to-date information.
50
-
Also be aware that Spring Boot's own API is {url-github-issues}/10712[not yet annotated].
49
+
WARNING: Be aware that Spring Boot's own API is {url-github-issues}/10712[not yet annotated].
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/PluginClasspathGradleBuild.java
0 commit comments