forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogic.java
More file actions
50 lines (46 loc) · 892 Bytes
/
Logic.java
File metadata and controls
50 lines (46 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
public class Logic {
boolean g(int i) {
return i < 2;
}
void f(int[] a, String s) {
boolean b =
((g(1)) ?
g(2) :
true);
if (b != false) {
} else {
}
int sz = a != null ? a.length : 0;
for (int i = 0; i < sz; i++) {
int e = a[i];
if (e > 2) break;
}
if (g(3))
s = "bar";
switch (s) {
case "bar":
break;
case "foo":
break;
default:
break;
}
Object o = g(4) ? null : s;
if (o instanceof String) {
}
}
void f2(int i) {
checkTrue(i > 0, "i pos");
checkFalse(g(100), "g");
if (i > 10) {
checkTrue(i > 20, "");
}
int dummy = 0;
}
private static void checkTrue(boolean b, String msg) {
if (!b) throw new Error (msg);
}
private static void checkFalse(boolean b, String msg) {
checkTrue(!b, msg);
}
}