All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.ObjectFinalizeOverridenCallsSuperFinalizeCheck.html Maven / Gradle / Ivy

The newest version!

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.

Noncompliant Code Example

protected void finalize() {   // Noncompliant; no call to super.finalize();
  releaseSomeResources();
}

protected void finalize() {
  super.finalize();  // Noncompliant; this call should come last
  releaseSomeResources();
}

Compliant Solution

protected void finalize() {
  releaseSomeResources();
  super.finalize();    
}

See





© 2015 - 2025 Weber Informatics LLC | Privacy Policy