Java: add previous-id and change 'use' to 'call'

This commit is contained in:
Jami Cogswell
2025-03-27 18:17:26 -04:00
parent 2e25498143
commit f73eda0c38
8 changed files with 9 additions and 8 deletions

View File

@@ -0,0 +1,28 @@
public class Test {
void f() throws Throwable {
// NON_COMPLIANT
this.finalize(); // $ Alert
}
void f1() throws Throwable {
f(); // COMPLIANT
}
@Override
protected void finalize() throws Throwable {
// COMPLIANT: If a subclass overrides `finalize`
// it must invoke the superclass finalizer explicitly.
super.finalize();
}
// Overload of `finalize`
protected void finalize(String s) throws Throwable {
System.out.println(s);
}
// NON_COMPLIANT: call to overload of `finalize`
void f2() throws Throwable {
this.finalize("overload"); // $ Alert
}
}