Files
openide/java/java-tests/testData/refactoring/extractMethodAndDuplicatesInplace/IntroduceObjectFailedWithLoop2.java
Bas Leijdekkers a32457cc15 [extract method] more strictly disallow multiple output variables in a loop (IDEA-373582)
GitOrigin-RevId: 11da42235328984f999ffc678b1c66b74746d7a0
2025-05-29 14:05:37 +00:00

22 lines
544 B
Java

public class Test {
public void validate(ArrayList<Supplier<Integer>> rules){
ArrayList<String> strings = null;
ArrayList<Integer> integers = null;
for (Supplier<Integer> rule : rules) {
<selection>int t = rule.get();
if (t == 1000) {
if (strings == null) {
strings = new ArrayList<>();
}
strings.add("q");
} else if (t == 2 || t == 3) {
if (integers == null) {
integers = new ArrayList<>();
}
integers.add(1);
}</selection>
}
}
}