Fields that may be null
should be annotated with @Nullable
. For example, do
this:
public class Foo {
@Nullable private String message = "hello";
public void reset() {
message = null;
}
}
Not this:
public class Foo {
private String message = "hello";
public void reset() {
message = null;
}
}
Suppress false positives by adding the suppression annotation @SuppressWarnings("FieldMissingNullable")
to the enclosing element.