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

There is a newer version: 8.6.0.37351
Show newest version

Object.finalize() is called by the Garbage Collector sometime after the object becomes 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 int finalize(int someParameter) {        // Noncompliant
  /* ... */
}

Compliant Solution

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy