mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-06-01 06:54:49 +07:00
ConvertSwitchToIfTest: test5 rewritten as getClass() is now pure
This commit is contained in:
+5
-3
@@ -1,7 +1,9 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Test {
|
||||
void foo(Object e) {
|
||||
Class<?> i = e.getClass();
|
||||
abstract class Test {
|
||||
abstract Object getObject();
|
||||
|
||||
void foo() {
|
||||
Class<?> i = getObject().getClass();
|
||||
if (i.equals(RuntimeException.class)) {
|
||||
} else if (i.equals(IOException.class)) {
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Test {
|
||||
void foo(Object e) {
|
||||
<caret>switch(e.getClass()) {
|
||||
abstract class Test {
|
||||
abstract Object getObject();
|
||||
|
||||
void foo() {
|
||||
<caret>switch(getObject().getClass()) {
|
||||
case RuntimeException.class:
|
||||
break;
|
||||
case IOException.class:
|
||||
|
||||
Reference in New Issue
Block a user