Hi,
since I didn’t find anything in the rule description: Java 8 added Objects.requireNonNull, so would this be a correct pattern to defensibly write methods with not-null parameters?
protected boolean add (@NotNull String foo) {
return fooList.add (Objects.requireNonNull (foo, "foo must not be null"));
}
(I know that tecnically, the requireNonNull is redundant with the @NotNull annotation, but it provides a safety net against buggy callers…
Would that be an useful addition to the rule description?
Regards, Tobias