mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<html>
|
|
<body>
|
|
Reports any calls to overridden methods of the current class during object construction.
|
|
This happens if an object construction is inside:
|
|
<ul>
|
|
<li>A constructor</li>
|
|
<li>A non-static instance initializer</li>
|
|
<li>A non-static field initializer</li>
|
|
<li><code>clone()</code></li>
|
|
<li><code>readObject()</code></li>
|
|
<li><code>readObjectNoData()</code></li>
|
|
</ul>
|
|
<p>Such calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
abstract class Parent {
|
|
void someMethod() { }
|
|
}
|
|
|
|
class Child extends Parent {
|
|
Child() {
|
|
someMethod();
|
|
}
|
|
|
|
@Override
|
|
void someMethod() { }
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>This inspection shares its functionality with:</p>
|
|
<ul>
|
|
<li>The <b>Abstract method called during object construction</b> inspection</li>
|
|
<li>The <b>Overridable method called during object construction</b> inspection</li>
|
|
</ul>
|
|
<p>Only one inspection should be enabled at the same time to prevent duplicate warnings.</p>
|
|
</body>
|
|
</html> |