Skip to content

Commit c5ba55f

Browse files
committed
Polish null-safety documentation
Issue: SPR-15756
1 parent a7617a2 commit c5ba55f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/docs/asciidoc/core/core-null-safety.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
= Null-safety
33

44
Although Java does not allow to express null-safety with its type system, Spring Framework
5-
now provides annotations declared in the `org.springframework.lang` package to declare
6-
nullability of APIs and fields.
5+
now provides annotations to declare nullability of APIs and fields.
76

8-
Spring Framework leverages these annotations, but they can also be used in any Spring based
7+
Spring Framework leverages itself these annotations, but they can also be used in any Spring based
98
Java project to declare null-safe APIs and optionally null-safe fields. Nullability of
109
types used inside method bodies is outside of the scope of this feature.
1110

@@ -15,6 +14,11 @@ warnings to Java developers related to null-safety in order to avoid `NullPointe
1514
at runtime. JSR 305 meta-annotations allows tooling vendors to provide null-safety support
1615
in a generic way, without having to hard-code support for Spring annotations.
1716

17+
[NOTE]
18+
====
19+
It is not necessary nor recommanded to have JSR 305 dependency in user project classpath.
20+
====
21+
1822
They are also used by Kotlin which supports natively
1923
https://kotlinlang.org/docs/reference/null-safety.html[null-safety]. By default, types from
2024
Java APIs used in Kotlin are recognized as
@@ -31,7 +35,7 @@ Other libraries like Reactor or Spring Data leverage these annotations as well t
3135
null-safe APIs.
3236
====
3337

34-
The following annotations are provided:
38+
The following annotations are provided in the `org.springframework.lang` package:
3539

3640
* {api-spring-framework}/lang/NonNull.html[`@NonNull`] annotation where specific parameter,
3741
return value, generic type argument, varargs element, array element or field cannot be `null`

0 commit comments

Comments
 (0)