mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
34 lines
1.0 KiB
HTML
34 lines
1.0 KiB
HTML
<html>
|
|
<body>
|
|
Reports calls to <code>abstract</code> methods of the current class during object construction.
|
|
<p>A method is called during object construction if it is inside a:
|
|
<ul>
|
|
<li>Constructor</li>
|
|
<li>Non-static instance initializer</li>
|
|
<li>Non-static field initializer</li>
|
|
<li><code>clone()</code> method</li>
|
|
<li><code>readObject()</code> method</li>
|
|
<li><code>readObjectNoData()</code> method</li>
|
|
</ul>
|
|
<p>Such calls may result in subtle bugs, as object initialization may happen before the method call.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
abstract class Parent {
|
|
abstract void abstractMethod();
|
|
}
|
|
|
|
class Child extends Parent {
|
|
Child() {
|
|
abstractMethod();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>This inspection shares the functionality with the following inspections:</p>
|
|
<ul>
|
|
<li>Overridable method called during object construction</li>
|
|
<li>Overridden method called during object construction</li>
|
|
</ul>
|
|
<p>Only one inspection should be enabled at once to prevent warning duplication.</p>
|
|
</body>
|
|
</html> |