summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/src/inspectionDescriptions/PointlessNullCheck.html
blob: 8d94468a2871fd76cbf46dd4a5d55dd23c416b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
<body>
<p>Reports a <b>null</b> check followed by an <b>instanceof</b> check.
Since the <b>instanceof</b> operator always returns <b>false</b> for <b>null</b>,
there is no need to have an additional <b>null</b> check. </p>
<p>Here is an example of a violation: </p>
<pre><code>    if (x != null && x instanceof String) { ... }</code></pre>
<p>The quickfix changes this code to:</p>
<pre><code>    if (x instanceof String) { ... }</code></pre>
<!-- tooltip end -->
<p>
<small>New in 11, Powered by InspectionGadgets</small>
</body>
</html>