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

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>