mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DFA test ReassignedVarInLoop
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import java.util.*;
|
||||
|
||||
public class ReassignedVarInLoop {
|
||||
public static void test(String text) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
int start = -1;
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
boolean flag = Character.isJavaIdentifierPart(c);
|
||||
if (flag && start == -1) {
|
||||
start = i;
|
||||
}
|
||||
if (flag && <warning descr="Condition 'start != -1' is always 'true' when reached">start != -1</warning>) {
|
||||
result.add("foo");
|
||||
}
|
||||
else if (<warning descr="Condition '!flag' is always 'true'">!flag</warning> && start != -1) {
|
||||
result.add("foo");
|
||||
start = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user