Require @NotNull and @Nullable annotations for all fields and parameters?

Kotlin is a JVM language built in support of null and non-null types . Java, as you know, does not have such support.

However, Java has @Nullable and @NotNull (or similar) annotations provided through Jetbrains , FindBugs , Android, and JSR305 .

Like Kotlin, I would like to require (via the IDE) all Java parameters and fields that must be annotated with one of these annotations. If possible, I would like to use CheckStyle as I already included it in our build workflow. However, I could not find any rules that are programmed for the purpose of annotations in a query CheckStyle checklist .

How do I do something like this?

+4
source share

Source: https://habr.com/ru/post/1615451/


All Articles