extract method: insert cast when duplicate with changed type processed (IDEA-98396)

This commit is contained in:
Anna Kozlova
2013-01-02 12:45:05 +01:00
parent 2e432c35fd
commit 7228521cd1
5 changed files with 33 additions and 1 deletions
@@ -0,0 +1,7 @@
class Test {
void foo(Object x) {
if (x instanceof String) x = ((String)x).substring(1);
if (x instanceof String) x = <selection>((String)x).substring(1)</selection>;
}
}
@@ -0,0 +1,11 @@
class Test {
void foo(Object x) {
if (x instanceof String) x = newMethod((String) x);
if (x instanceof String) x = newMethod((String) x);
}
private String newMethod(String x) {
return ((String)x).substring(1);
}
}