extract method: inline output variable if it is returned right after creation ( IDEA-54490 )

This commit is contained in:
anna
2010-05-06 20:20:40 +04:00
parent 9b301801a6
commit 2293b5a5a7
6 changed files with 45 additions and 5 deletions

View File

@@ -12,8 +12,7 @@ class C {
}
private List newMethod(Object[] array) {
List l1 = new ArrayList(Arrays.asList(array));
return l1;
return new ArrayList(Arrays.asList(array));
}
String[] getObjects() {

View File

@@ -7,7 +7,6 @@ class C {
}
private int newMethod() {
final int i = 128;
return i;
return 128;
}
}

View File

@@ -0,0 +1,8 @@
class Test {
void foo() {
<selection>int j = 0;
int i = 0;
j = 9;</selection>
System.out.println(i);
}
}

View File

@@ -0,0 +1,13 @@
class Test {
void foo() {
int i = newMethod();
System.out.println(i);
}
private int newMethod() {
int j = 0;
int i = 0;
j = 9;
return i;
}
}