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

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

There is a newer version: 8.6.0.37351
Show newest version

The contract of the Object.finalize() method is clear: only the Garbage Collector is supposed to call this method.

Making this method public is misleading, because it implies that any caller can use it.

Noncompliant Code Example

public class MyClass {

  @Override
  public void finalize() {    // Noncompliant
    /* ... */
  }
}

See

  • MITRE, CWE-583 - finalize() Method Declared Public
  • CERT Java Secure Coding, MET12-J - Do not use finalizers




© 2015 - 2025 Weber Informatics LLC | Privacy Policy