mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 07:20:53 +07:00
Fixes IDEA-288570 Constant conditions & exceptions thinks that Iterator.hasNext() cannot modify a private field GitOrigin-RevId: 116a0ca754004574fe6d789db1889a52d9057bfd
28 lines
585 B
Java
28 lines
585 B
Java
import java.util.*;
|
|
|
|
class Test implements Iterator<String> {
|
|
String myNext;
|
|
|
|
public boolean hasNext() {
|
|
myNext = "test";
|
|
return true;
|
|
}
|
|
|
|
public String next() {
|
|
if (!hasNext()) throw new NoSuchElementException();
|
|
return myNext;
|
|
}
|
|
|
|
void test() {
|
|
int merged = 0;
|
|
while (hasNext()) {
|
|
assert myNext != null;
|
|
merged++;
|
|
if (<warning descr="Condition 'merged > 50' is always 'false'">merged > 50</warning>) {
|
|
break;
|
|
}
|
|
myNext = <warning descr="Assigning 'null' value to non-annotated field">null</warning>;
|
|
}
|
|
}
|
|
}
|