mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
<html>
|
|
<body>
|
|
Reports calls to overridable 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>
|
|
<p>Methods are overridable if they are not declared as <code>final</code>, <code>static</code>, or <code>private</code>.
|
|
Package-local methods are considered safe, even though they are overridable. Such calls may result in subtle bugs,
|
|
as object initialization may happen before the method call.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Parent {
|
|
void someMethod() { }
|
|
}
|
|
|
|
class Child extends Parent {
|
|
Child() {
|
|
someMethod();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>This inspection shares the functionality with the following inspections:</p>
|
|
<ul>
|
|
<li>Abstract 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> |