Files
openide/java/java-tests/testData/inspection/commonIfParts/afterNeedInvert.java
Tagir Valeev 6c02bcf415 [java-inspections] IfStatementWithIdenticalBranchesInspection: support if-else merge inverting the second condition
Fixes IDEA-323850 Null-check and 'instanceof' combination could be simplified

GitOrigin-RevId: 20f5706ac06d6b1b0771b744fc20898de2d452d1
2023-07-31 15:35:27 +00:00

11 lines
278 B
Java

// "Merge 'else if' statement inverting the second condition" "true"
class Test {
String[] foo(Object[] value, String[] defaultValue) {
if (value == null || !(value instanceof String[])) {
return defaultValue;
} else {
return (String[]) value;
}
}
}