finalize() Method Without super.finalize()
Weakness ID: 568 (Weakness Variant)Status: Draft
+ Description

Description Summary

The software contains a finalize() method that does not call super.finalize().

Extended Description

The Java Language Specification states that it is a good practice for a finalize() method to call super.finalize()

+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

Java

+ Demonstrative Examples

Example 1

The following method omits the call to super.finalize().

(Bad Code)
Example Language: Java 
protected void finalize() {
discardNative();
}
+ Potential Mitigations

Call the super.finalize() method.

Use static analysis tools to spot such issues in your code.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory399Resource Management Errors
Development Concepts (primary)699
ChildOfWeakness BaseWeakness Base404Improper Resource Shutdown or Release
Research Concepts (primary)1000
ChildOfWeakness ClassWeakness Class573Failure to Follow Specification
Research Concepts1000
+ Content History
Modifications
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Potential Mitigations, Time of Introduction
2008-09-08CWE Content TeamMITREInternal
updated Relationships, Other Notes
2009-10-29CWE Content TeamMITREInternal
updated Description, Other Notes
Previous Entry Names
Change DatePrevious Entry Name
2008-04-11Erroneous Finalize Method