2
2
= Null-safety
3
3
4
4
Although Java does not let you express null-safety with its type system, the Spring Framework
5
- now provides the following annotations in the `org.springframework.lang` package to let you
5
+ provides the following annotations in the `org.springframework.lang` package to let you
6
6
declare nullability of APIs and fields:
7
7
8
8
* {api-spring-framework}/lang/Nullable.html[`@Nullable`]: Annotation to indicate that a
@@ -17,11 +17,10 @@ level that declares non-null as the default semantics for fields.
17
17
18
18
The Spring Framework itself leverages these annotations, but they can also be used in any
19
19
Spring-based Java project to declare null-safe APIs and optionally null-safe fields.
20
- Generic type arguments, varargs and array elements nullability are not supported yet but
21
- should be in an upcoming release, see https://jira.spring.io/browse/SPR-15942[SPR-15942]
22
- for up-to-date information. Nullability declarations are expected to be fine-tuned between
23
- Spring Framework releases, including minor ones. Nullability of types used inside method
24
- bodies is outside of the scope of this feature.
20
+ Generic type arguments, varargs and array elements nullability are not supported yet.
21
+ Nullability declarations are expected to be fine-tuned between Spring Framework releases,
22
+ including minor ones. Nullability of types used inside method bodies is outside the
23
+ scope of this feature.
25
24
26
25
NOTE: Other common libraries such as Reactor and Spring Data provide null-safe APIs that
27
26
use a similar nullability arrangement, delivering a consistent overall experience for
@@ -38,7 +37,7 @@ these annotations can be used by an IDE (such as IDEA or Eclipse) to provide use
38
37
warnings related to null-safety in order to avoid `NullPointerException` at runtime.
39
38
40
39
They are also used to make Spring API null-safe in Kotlin projects, since Kotlin natively
41
- supports https://kotlinlang.org/docs/reference/ null-safety.html[null-safety]. More details
40
+ supports https://kotlinlang.org/docs/null-safety.html[null-safety]. More details
42
41
are available in the xref:languages/kotlin/null-safety.adoc[Kotlin support documentation].
43
42
44
43
0 commit comments