AddNullMarkedToClass
Apply @NullMarked to this class

Severity
SUGGESTION

The problem

Checks if @NullMarked annotation is applied to a Java class.

When you apply @NullMarked to a module, package, class, or method, it means that unannotated types in that scope are treated as if they were annotated with @NonNull, with some exceptions for local variables and type variables. In code covered by @NullMarked, String x means the same as @NonNull String x.

This standardizes the default annotation for all static checkers and compilers that support JSpecify annotations.

For more information, see https://jspecify.dev/docs/user-guide/#nullmarked.

Choice of Granularity

Typically, projects should choose only one of the following approaches and not both:

For a project, it is recommended to either nullmark all the classes or all of the package-info files, but not both.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("AddNullMarkedToClass") to the enclosing element.