From f18a85e193889a6087b652a022e71d713b607406 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 13 Jun 2023 11:57:41 +0200 Subject: [PATCH] Polish null-safety documentation --- .../modules/ROOT/pages/core/null-safety.adoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/null-safety.adoc b/framework-docs/modules/ROOT/pages/core/null-safety.adoc index c87d622ad5c..e43ad7d0f41 100644 --- a/framework-docs/modules/ROOT/pages/core/null-safety.adoc +++ b/framework-docs/modules/ROOT/pages/core/null-safety.adoc @@ -8,7 +8,7 @@ declare nullability of APIs and fields: * {api-spring-framework}/lang/Nullable.html[`@Nullable`]: Annotation to indicate that a specific parameter, return value, or field can be `null`. * {api-spring-framework}/lang/NonNull.html[`@NonNull`]: Annotation to indicate that a specific -parameter, return value, or field cannot be `null` (not needed on parameters / return values +parameter, return value, or field cannot be `null` (not needed on parameters, return values, and fields where `@NonNullApi` and `@NonNullFields` apply, respectively). * {api-spring-framework}/lang/NonNullApi.html[`@NonNullApi`]: Annotation at the package level that declares non-null as the default semantics for parameters and return values. @@ -17,7 +17,7 @@ level that declares non-null as the default semantics for fields. The Spring Framework itself leverages these annotations, but they can also be used in any Spring-based Java project to declare null-safe APIs and optionally null-safe fields. -Generic type arguments, varargs and array elements nullability are not supported yet. +Nullability declarations for generic type arguments, varargs, and array elements are not supported yet. Nullability declarations are expected to be fine-tuned between Spring Framework releases, including minor ones. Nullability of types used inside method bodies is outside the scope of this feature. @@ -36,7 +36,7 @@ In addition to providing an explicit declaration for Spring Framework API nullab these annotations can be used by an IDE (such as IDEA or Eclipse) to provide useful warnings related to null-safety in order to avoid `NullPointerException` at runtime. -They are also used to make Spring API null-safe in Kotlin projects, since Kotlin natively +They are also used to make Spring APIs null-safe in Kotlin projects, since Kotlin natively supports https://kotlinlang.org/docs/null-safety.html[null-safety]. More details are available in the xref:languages/kotlin/null-safety.adoc[Kotlin support documentation]. @@ -47,11 +47,11 @@ are available in the xref:languages/kotlin/null-safety.adoc[Kotlin support docum == JSR-305 meta-annotations Spring annotations are meta-annotated with https://jcp.org/en/jsr/detail?id=305[JSR 305] -annotations (a dormant but wide-spread JSR). JSR-305 meta-annotations let tooling vendors +annotations (a dormant but widespread JSR). JSR-305 meta-annotations let tooling vendors like IDEA or Kotlin provide null-safety support in a generic way, without having to hard-code support for Spring annotations. -It is not necessary nor recommended to add a JSR-305 dependency to the project classpath to -take advantage of Spring null-safe API. Only projects such as Spring-based libraries that use +It is neither necessary nor recommended to add a JSR-305 dependency to the project classpath to +take advantage of Spring's null-safe APIs. Only projects such as Spring-based libraries that use null-safety annotations in their codebase should add `com.google.code.findbugs:jsr305:3.0.2` -with `compileOnly` Gradle configuration or Maven `provided` scope to avoid compile warnings. +with `compileOnly` Gradle configuration or Maven `provided` scope to avoid compiler warnings.