Class SuperFinalizeCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class SuperFinalizeCheck
    extends AbstractSuperCheck

    Checks that an overriding finalize() method invokes super.finalize(). Does not check native methods, as they have no possible java defined implementation.

    References: How to Handle Java Finalization's Memory-Retention Issues; 10 points on finalize method in Java.

    To configure the check:

     <module name="SuperFinalize"/>


     public class A {
          protected void finalize() throws Throwable {
             System.out.println("In finalize block");
              super.finalize(); // OK, calls super.finalize()
     public class B {
          protected void finalize() throws Throwable { // violation
              System.out.println("In finalize block");

    Parent is

    Violation Message Keys: