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

32 lines
806 B
HTML

<html>
<body>
Reports any implementations of the <code>Object.finalize()</code> method that are
declared <code>public</code>.
<p>
According to the contract of the <code>Object.finalize()</code>, only the garbage
collector calls this method. Making this method public may be confusing, because it
means that the method can be used from other code.
</p>
<p>
A quick-fix is provided to make the method <code>protected</code>, to prevent it from being invoked
from other classes.
</p>
<!-- tooltip end -->
<p><b>Example:</b></p>
<pre><code>
<b>class</b> X {
<b>public void</b> finalize() {
/* ... */
}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
<b>class</b> X {
<b>protected void</b> finalize() {
/* ... */
}
}
</code></pre>
</body>
</html>