
resources.report.rules.pmd.FinalizeShouldBeProtected.html Maven / Gradle / Ivy
FinalizeShouldBeProtected
FinalizeShouldBeProtected
If you override finalize(), make it protected. If you make
it public, other classes may call it.
This rule is defined by the following XPath expression:
//MethodDeclaration[@Protected="false"]
/MethodDeclarator[@Image="finalize"]
[not(FormalParameters/*)]
Example:
public class Foo {
public void finalize() {
// do something
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy