org.sonar.l10n.java.rules.squid.S1175.html Maven / Gradle / Ivy
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