mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 15:41:26 +07:00
23 lines
678 B
Java
23 lines
678 B
Java
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;
|
|
}
|
|
}
|
|
}
|
|
}
|