mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Java: add more test cases
This commit is contained in:
@@ -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'. |
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user