The well-known Jetbrains nullability annotations, but with RUNTIME retention
<dependency>
<groupId>com.github.bbottema</groupId>
<artifactId>jetbrains-runtime-annotations</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
There are currently no nullability annotations available that are available for reflection in runtime. The community used to have the javax.annotation.Nullable
from FindBugs' and later SpotBugs' JSR305 implementation, but as that uses the same packages as the JDK, with Java's modularization, this can cause the split-package problem.
Modern IDE's natively handle these annotations and common static analyses (like the Maven SpotBugs plugin) understand these annotations, but are limited to a specific set of known common packages or certain Java class names. The Jetbrains annotations, and possible the Eclipse annotations, are the most neutral and light-weight libraries available that are supported this way. Google's Checker Qual brings a lot of baggage and the others are focussed on Android or are very old.
That leaves us with the Jetbrains annotations, but they are limited to CLASS retention and its developers have no plans to change this. They in fact suggest to recompile them with RUNTIME retention.
This library simply copies the source code for the Jetbrains nullability annotations (only @NotNull and @Nullable) and changes the retention from CLASS to RUNTIME