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.

Noncompliant Code Example

if (x != null && x instanceof MyClass) { ... }  // Noncompliant

if (x == null || ! x instanceof MyClass) { ... } // Noncompliant

Compliant Solution

if (x instanceof MyClass) { ... }

if (! x instanceof MyClass) { ... }