
org.sonar.l10n.squidjava.rules.squid.ObjectFinalizeOverridenCallsSuperFinalizeCheck.html Maven / Gradle / Ivy
Overriding the Object.finalize()
method must be done with caution to dispose some system resources.
Calling the super.finalize()
at the end of this method implementation is highly recommended in case parent implementations must also dispose some system resources.
The following code snippet illustrates this rule:
protected void finalize() { // Non-Compliant
releaseSomeResources();
}
protected void finalize() {
super.finalize(); // Non-Compliant
releaseSomeResources();
}
protected void finalize() {
releaseSomeResources();
super.finalize(); // Compliant
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy