IDEA-204917 "Loop can be collapsed with Stream API" creates uncompilable results in some cases

1. Look for references inside IntStream.iterate condition (Java9+)
2. When simplifying IntStream.range(...).map(i -> arr[i]) check if arr expression don't refer to i
This commit is contained in:
Tagir Valeev
2019-01-06 10:25:15 +07:00
parent 677af06353
commit 725cf20422
5 changed files with 42 additions and 2 deletions
@@ -0,0 +1,13 @@
// "Replace with reduce()" "false"
public class Foo {
boolean isAnyFalse(boolean[] array) {
boolean status = true;
f<caret>or (int i = 0; i < array.length & status; i++) {
status &= array[i];
}
return status;
}
}