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

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

The newest version!

Object.finalize() is called by the Garbage Collector sometime after the object became unreferenced.

Overloading this method is misleading:

  • The overload will not be called by the Garbage Collector.
  • Users are not expected to call Object.finalize() and will get confused.

Another name should be picked for the method.

Noncompliant Code Example

public void finalize(int someParameter) {        // Non-Compliant
  /* ... */
}

Compliant Solution

public void someBetterName(int someParameter) {  // Compliant
  /* ... */
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy