Java
Unnecessary 'null' check before method call
Warning
New
Last modified: 03 December 2024 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)) { ... }
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
PointlessNullCheck
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!
Was this page helpful?