Jtest logo




Contents  Previous  Next  Index

GC.IFF


Invoke `super.finalize()' in the `finally' blocks of `finalize()' methods

Description

This rule flags code where the "finally" block of a `finalize()' method does not invoke `super.finalize()'.

Example

 package GC;
 
 class IFF {
     public void finalize() throws Throwable {
        try {
        } catch (Exception e) {
        } finally {
        }                        // Violation
     }
 }

Repair

 class BetterIFF {
     public void finalize() throws Throwable {
        try {
        } catch (Exception e) {
        } finally {
           super.finalize();
        }
     }
 }

Reference

Arnold, Ken, and Gosling, James The Java Programming Language. 2d ed. Addison Wesley, 1997, pp. 49.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft