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.
|