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

30 lines
1.4 KiB
HTML

<html>
<body>
Reports overriding the <code>Object.finalize()</code> method.
<p>According to the <code>Object.finalize()</code> documentation:</p>
<blockquote>
<p>
The finalization mechanism is inherently problematic. Finalization can lead
to performance issues, deadlocks, and hangs. Errors in finalizers can lead
to resource leaks; there is no way to cancel finalization if it is no longer
necessary; and no ordering is specified among calls to <code>finalize</code>
methods of different objects. Furthermore, there are no guarantees regarding
the timing of finalization. The <code>finalize</code> method might be called
on a finalizable object only after an indefinite delay, if at all.
</p>
</blockquote>
<!-- tooltip end -->
<p>Configure the inspection:</p>
<ul>
<li>
Use the <b>Ignore for trivial 'finalize()' implementations</b> option to ignore
<code>finalize()</code> implementations with an empty method body or a body
containing only <code>if</code> statements that have a condition which evaluates
to <code>false</code> and is a compile-time constant. For performance reasons it
can be beneficial to override a non-trivial <code>finalize()</code> with an empty
implementation in a subclass. An empty final <code>finalize()</code> implementation
can also be used to prevent subclasses from overriding.
</li>
</ul>
</body>
</html>