A method named finalize has parameters or a result, so the runtime never calls it
What it finds
The garbage collector calls protected void finalize() without parameters. A method finalize(int) or int finalize() only shares the name: it is never called for cleanup, and readers take it for a finalizer.
Reported is a method named finalize with parameters, or without parameters but with a result.
From the rule's source, finalize_overload.rs.
class Resource { protected void finalize(int code) {}tx0 reports: does not override Object.finalize() int finalize(String reason) {tx0 reports: does not override return 0; } @Override protected void finalize() {}} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/java:finalize-overload" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:finalize-overload] reason="..."tx0 explain tx0/java:finalize-overload shows the same in the terminal. Found a false positive? Report it.