mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Java: update to only find 'finalize' calls and add 'super.finalize' exclusion
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| Test.java:3:9:3:23 | finalize(...) | Call to 'finalize'. |
|
||||
@@ -0,0 +1 @@
|
||||
Violations of Best Practice/Undesirable Calls/DoNotUseFinalize.ql
|
||||
9
java/ql/test/query-tests/DoNotUseFinalize/Test.java
Normal file
9
java/ql/test/query-tests/DoNotUseFinalize/Test.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Test {
|
||||
void f() throws Throwable {
|
||||
this.finalize(); // NON_COMPLIANT
|
||||
}
|
||||
|
||||
void f1() throws Throwable {
|
||||
f(); // COMPLIANT
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
| Test.java:3:9:3:19 | gc(...) | Call to prohibited method that may modify the JVM's garbage collection process. |
|
||||
| Test.java:4:9:4:33 | gc(...) | Call to prohibited method that may modify the JVM's garbage collection process. |
|
||||
| Test.java:5:9:5:23 | finalize(...) | Call to prohibited method that may modify the JVM's garbage collection process. |
|
||||
@@ -1 +0,0 @@
|
||||
rules/J-FIN-002/DoNotUseFinalizers.ql
|
||||
@@ -1,13 +0,0 @@
|
||||
public class Test {
|
||||
void f() throws Throwable {
|
||||
System.gc(); // NON_COMPLIANT
|
||||
Runtime.getRuntime().gc(); // NON_COMPLIANT
|
||||
this.finalize(); // NON_COMPLIANT
|
||||
// this is removed in Java 11
|
||||
//System.runFinalizersOnExit(true); // NON_COMPLIANT
|
||||
}
|
||||
|
||||
void f1() throws Throwable {
|
||||
f(); // COMPLIANT
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user