mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Java: Added nested local class test case
This commit is contained in:
@@ -4,3 +4,7 @@
|
||||
| ExampleRuntimeHalt.java:21:17:21:44 | halt(...) | Avoid calls to Runtime.halt() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| ExampleSystemExit.java:22:17:22:30 | exit(...) | Avoid calls to System.exit() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| ExampleSystemExit.java:25:17:25:30 | exit(...) | Avoid calls to System.exit() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| LocalClassInTestMethod.java:7:25:7:38 | exit(...) | Avoid calls to System.exit() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| LocalClassInTestMethod.java:8:25:8:52 | halt(...) | Avoid calls to Runtime.halt() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| LocalClassInTestMethod.java:20:21:20:34 | exit(...) | Avoid calls to System.exit() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
| LocalClassInTestMethod.java:21:21:21:48 | halt(...) | Avoid calls to Runtime.halt() as this prevents runtime cleanup and makes code harder to reuse. |
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
public class LocalClassInTestMethod {
|
||||
public void testNestedCase() {
|
||||
class OuterLocalClass {
|
||||
void func() {
|
||||
class NestedLocalClass {
|
||||
void nestedMethod() {
|
||||
System.exit(4); // $ SPURIOUS: Alert
|
||||
Runtime.getRuntime().halt(5); // $ SPURIOUS: Alert
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OuterLocalClass outer = new OuterLocalClass();
|
||||
outer.func();
|
||||
}
|
||||
public void testNestedCase2() {
|
||||
class OuterLocalClass {
|
||||
class NestedLocalClass {
|
||||
void nestedMethod() {
|
||||
System.exit(4); // $ SPURIOUS: Alert
|
||||
Runtime.getRuntime().halt(5); // $ SPURIOUS: Alert
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user