mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
stream api: do not collapse loops when body is not throws compatible (IDEA-125541)
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
// "Replace with collect" "false"
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ForEachTest {
|
||||
|
||||
interface A {
|
||||
String ii() throws IOException;
|
||||
}
|
||||
private List<A> reqs;
|
||||
|
||||
public ForEachTest () throws IOException {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(A val : re<caret>qs) {
|
||||
result.add(val.ii());
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with forEach" "false"
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
|
||||
private List<byte[]> reqs;
|
||||
|
||||
public ForEachTest () throws IOException {
|
||||
DataOutputStream req = new DataOutputStream(new ByteArrayOutputStream());
|
||||
for(byte[] val : r<caret>eqs) {
|
||||
req.write(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user