File tree 2 files changed +20
-1
lines changed
java/ql/test/query-tests/DoNotUseFinalize
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
- | Test.java:3:9:3:23 | finalize(...) | Call to 'finalize'. |
1
+ | Test.java:4:9:4:23 | finalize(...) | Call to 'finalize'. |
2
+ | Test.java:25:9:25:33 | finalize(...) | Call to 'finalize'. |
Original file line number Diff line number Diff line change @@ -7,4 +7,22 @@ void f() throws Throwable {
7
7
void f1 () throws Throwable {
8
8
f (); // COMPLIANT
9
9
}
10
+
11
+ @ Override
12
+ protected void finalize () throws Throwable {
13
+ // COMPLIANT: If a subclass overrides `finalize`
14
+ // it must invoke the superclass finalizer explicitly.
15
+ super .finalize ();
16
+ }
17
+
18
+ // Overload of `finalize`
19
+ protected void finalize (String s ) throws Throwable {
20
+ System .out .println (s );
21
+ }
22
+
23
+ // NON_COMPLIANT: call to overload of `finalize`
24
+ void f2 () throws Throwable {
25
+ this .finalize ("overload" ); // $ Alert
26
+ }
27
+
10
28
}
You can’t perform that action at this time.
0 commit comments