ConvertSwitchToIfTest: test5 rewritten as getClass() is now pure

This commit is contained in:
Tagir Valeev
2017-05-18 14:36:52 +07:00
parent 1fccd8f503
commit f2442e32fa
2 changed files with 10 additions and 6 deletions

View File

@@ -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)) {
}