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

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>