IfStatementWithIdenticalBranches: explicit type for array assignment

IDEA-190203
This commit is contained in:
Roman.Ivanov
2018-04-16 18:10:29 +07:00
parent 6b26c488d1
commit 8b9195d87b
3 changed files with 47 additions and 5 deletions
@@ -0,0 +1,17 @@
// "Extract common part with variables from if " "true"
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String... args) {
int i = 1;
String[] array;
if (i % 2 == 0) {
array = new String[]{};
} else {
array = new String[]{"not empty"};
}
main(array);
}
}
@@ -0,0 +1,17 @@
// "Extract common part with variables from if " "true"
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String... args) {
int i = 1;
if<caret> (i % 2 == 0) {
String[] array = {};
main(array);
} else {
String[] array = {"not empty"};
main(array);
}
}
}