JSR-305 specifies a number of annotations to assist defect detection tools.
The following annotations should be supported by SonarJava:
- @javax.annotation.ParametersAreNonnullByDefault at the class or method level.
- @javax.annotation.ParametersAreNullableByDefault at the class or method level.
Similarly, the Eclipse IDE supports the following annotations:
IntelliJ also provides their custom annotations in org.jetbrains:annotations artefact:
Spring 5 introduced the following ones, which are using @javax.annotation.Nullable and @javax.annotation.Nonnull from JSR-305 as meta-annotations:
Instead of implemented explicit handling of these new eclipse annotations, a better approach could be to handle meta-annotations direction, which would allow us to also identify custom usages such as: