Files
openide/java/java-tests/testData/refactoring/inplaceIntroduceVariable/splitMutuallyExclusiveIf.java
Tagir Valeev 6253884c82 [java-refactoring] CodeBlockSurrounder: allow if-splitting when extracting from && chain when else-branch is mutually exclusive
Fixes IDEA-309095 Improve the Safety of "Introduce Variable" Refactorings concening ClassCasts

GitOrigin-RevId: a9c401378523aaf0142cde161e477a3675de3d5f
2023-01-19 16:16:47 +00:00

9 lines
334 B
Java

public class splitMutuallyExclusiveIf {
void foo(Object obj) {
if (obj instanceof Integer && ((Integer) obj).intValue() > 0) {
System.out.println(((Integer) obj).int<caret>Value());
} else if (obj instanceof Float && ((Float) obj).floatValue() > 0.0) {
System.out.println(((Float) obj).floatValue());
}
}
}