Inspectopedia Help

'finalize()' should not be overridden

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.

Inspection options

Option

Type

Default

Ignore for trivial 'finalize()' implementations

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023