extract method: allow to choose return type from hierarchy (IDEA-79995)

This commit is contained in:
Anna Kozlova
2014-12-02 19:34:40 +01:00
parent 72515b5403
commit c6110f2cfa
13 changed files with 273 additions and 21 deletions
@@ -0,0 +1,13 @@
class X {
void foo(java.util.List l) {
for (Object o : l) {
<selection>if (o == null) continue;
String x = bar(o);</selection>
System.out.println(x);
}
}
private String bar(Object o) {
return "";
}
}
@@ -0,0 +1,22 @@
import org.jetbrains.annotations.Nullable;
class X {
void foo(java.util.List l) {
for (Object o : l) {
Object x = newMethod(o);
if (x == null) continue;
System.out.println(x);
}
}
@Nullable
private Object newMethod(Object o) {
if (o == null) return null;
String x = bar(o);
return x;
}
private String bar(Object o) {
return "";
}
}