mirror of
https://github.com/github/codeql.git
synced 2026-06-13 08:51:20 +02:00
36 lines
1008 B
Java
36 lines
1008 B
Java
class Test {
|
|
private int z;
|
|
void test(int x) {
|
|
z = getInt();
|
|
if (x < 0 || z < 0) {
|
|
throw new Error();
|
|
}
|
|
int y = 0;
|
|
if (x >= 0) y++; // $ Alert // useless test due to test in line 5 being false
|
|
if (z >= 0) y++; // $ Alert // useless test due to test in line 5 being false
|
|
while(x >= 0) {
|
|
if (y < 10) {
|
|
z++;
|
|
if (y == 15) z++; // $ Alert // useless test due to test in line 12 being true
|
|
y++;
|
|
z--;
|
|
} else if (y > 7) { // $ Alert // useless test due to test in line 12 being false
|
|
y--;
|
|
}
|
|
if (!(y != 5) && z >= 0) { // $ Alert // z >= 0 is always true due to line 5 (and z being increasing)
|
|
int w = y < 3 ? 0 : 1; // $ Alert // useless test due to test in line 20 being true
|
|
}
|
|
x--;
|
|
}
|
|
}
|
|
void test2(int x) {
|
|
if (x != 0) {
|
|
int w = x == 0 ? 1 : 2; // $ Alert // useless test due to test in line 27 being true
|
|
x--;
|
|
} else if (x == 0) { // $ Alert // useless test due to test in line 27 being false
|
|
x++;
|
|
}
|
|
}
|
|
int getInt() { return 0; }
|
|
}
|