Object.finalize() method.
According to the Object.finalize() documentation:
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
finalizemethods of different objects. Furthermore, there are no guarantees regarding the timing of finalization. Thefinalizemethod might be called on a finalizable object only after an indefinite delay, if at all.
Configure the inspection:
finalize() implementations with an empty method body or a body
containing only if statements that have a condition which evaluates
to false at compile time. For performance reasons it can be beneficial
to override a non-trivial finalize() with an empty implementation in a
subclass. An empty final finalize() implementation can also be used to
prevent subclasses from overriding.