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

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

There is a newer version: 8.10.0.38194
Show newest version

Why is this an issue?

Object.finalize() is called by the Garbage Collector at some point after the object becomes unreferenced.

In general, overloading Object.finalize() is a bad idea because:

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

But beyond that it’s a terrible idea to name a method "finalize" if it doesn’t actually override Object.finalize().

Noncompliant code example

public int finalize(int someParameter) {        // Noncompliant
  /* ... */
}

Compliant solution

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy