mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
30 lines
858 B
HTML
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> |