Files
openide/java/java-impl/resources/inspectionDescriptions/InstanceofIncompatibleInterface.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

30 lines
858 B
HTML

<html>
<body>
Reports <code>instanceof</code> expressions where
the expression that is checked has a class/interface type that neither extends/implements the class/interface type on the right-side of the
<code>instanceof</code> expression, nor has subclasses that do.
<p>
Although it could be intended for e.g. library code, such a construct is likely erroneous,
because no instance of any class declared in the project could pass this <code>instanceof</code> test.
</p>
<p><b>Example:</b></p>
<pre><code>
class Foo { }
interface Bar { }
class Main {
void test(Foo f, Bar b) {
if (f instanceof Bar) { // problem
System.out.println("fail");
}
if (b instanceof Foo) { // problem
System.out.println("fail");
}
}
}
</code></pre>
<!-- tooltip end -->
</body>
</html>