|
This version is still in development and is not considered stable yet. For the latest stable version, please use Spring REST Docs 4.0.0! |
Null Safety
Spring REST Docs is annotated with JSpecify annotations to declare the nullability of its API. To learn more about JSpecify, its user guide is recommended reading.
The primary goal of declaring the nullability of the API is to prevent a NullPointerException from being thrown at runtime.
This is achieved through build-time checks that are available with both Java and Kotlin.
Performing the checks with Java requires some tooling such as NullAway or an IDE that supports JSpecify annotations such as IntelliJ IDEA.
The checks are available automatically with Kotlin which translates the JSpecify annotations into Kotlin’s null safety.
To learn more about null safety with Spring, refer to the Spring Framework reference documentation.