Inspectopedia
 
2024.3

'finalize()' should not be overridden

Warning
New
Last modified: 03 December 2024

Reports overriding the Object.finalize() method.

According to the Object.finalize() documentation:

Configure the inspection:

  • Use the Ignore for trivial 'finalize()' implementations option to ignore finalize() implementations with an empty method body or a body containing only if statements that have a condition which evaluates to false and is a compile-time constant. 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.