mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +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"
|
// "Replace 'switch' with 'if'" "true"
|
||||||
class Test {
|
abstract class Test {
|
||||||
void foo(Object e) {
|
abstract Object getObject();
|
||||||
Class<?> i = e.getClass();
|
|
||||||
|
void foo() {
|
||||||
|
Class<?> i = getObject().getClass();
|
||||||
if (i.equals(RuntimeException.class)) {
|
if (i.equals(RuntimeException.class)) {
|
||||||
} else if (i.equals(IOException.class)) {
|
} else if (i.equals(IOException.class)) {
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -1,7 +1,9 @@
|
|||||||
// "Replace 'switch' with 'if'" "true"
|
// "Replace 'switch' with 'if'" "true"
|
||||||
class Test {
|
abstract class Test {
|
||||||
void foo(Object e) {
|
abstract Object getObject();
|
||||||
<caret>switch(e.getClass()) {
|
|
||||||
|
void foo() {
|
||||||
|
<caret>switch(getObject().getClass()) {
|
||||||
case RuntimeException.class:
|
case RuntimeException.class:
|
||||||
break;
|
break;
|
||||||
case IOException.class:
|
case IOException.class:
|
||||||
|
|||||||
Reference in New Issue
Block a user