There’s no need to null test in conjunction with an instanceof
test. null
is not an instanceof
anything, so
a null check is redundant.
if (x != null && x instanceof MyClass) { ... } // Noncompliant if (x == null || ! x instanceof MyClass) { ... } // Noncompliant
if (x instanceof MyClass) { ... } if (! x instanceof MyClass) { ... }