Back to Intellij Community

PointlessNullCheck

java/java-impl/resources/inspectionDescriptions/PointlessNullCheck.html

2025.3-rc-2370 B
Original Source

Reports null checks followed by a method call that will definitely return false when null is passed (e.g. Class.isInstance).

Such a check seems excessive as the method call will always return false in this case.

Example:

if (x != null && myClass.isInstance(x)) { ... }

After the quick-fix is applied:

if (myClass.isInstance(x)) { ... }