Java: add more test cases

This commit is contained in:
Jami Cogswell
2025-03-20 20:36:21 -04:00
parent d9482ae334
commit c689a0e9b7
2 changed files with 20 additions and 1 deletions

View File

@@ -1 +1,2 @@
| Test.java:3:9:3:23 | finalize(...) | Call to 'finalize'. |
| Test.java:4:9:4:23 | finalize(...) | Call to 'finalize'. |
| Test.java:25:9:25:33 | finalize(...) | Call to 'finalize'. |

View File

@@ -7,4 +7,22 @@ public class Test {
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
}
}