mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 15:41:26 +07:00
generate "constant".equals(variable) code when converting switch to if (IDEA-157516)
This commit is contained in:
+2
-2
@@ -4,8 +4,8 @@ abstract class Test {
|
||||
|
||||
void foo() {
|
||||
Class<?> i = getObject().getClass();
|
||||
if (i.equals(RuntimeException.class)) {
|
||||
} else if (i.equals(IOException.class)) {
|
||||
if (RuntimeException.class.equals(i)) {
|
||||
} else if (IOException.class.equals(i)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class X {
|
||||
public void doSomething( String value) {
|
||||
if ("case1".equals(value)) {
|
||||
} else if ("case2".equals(value)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class X {
|
||||
public void doSomething( String value) {
|
||||
switch<caret> ( value ) {
|
||||
case "case1":
|
||||
break;
|
||||
case "case2":
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user