mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-151867 ExtractMethodObject drops declaration of local variable when it is shared with a return value
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
public int context1() {
|
||||
<selection>int i, j;
|
||||
i = 0;
|
||||
j = 1;
|
||||
if (j > 0) return i;
|
||||
</selection>
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
class Test {
|
||||
public int context1() {
|
||||
Inner inner = new Inner().invoke();
|
||||
if (inner.is()) return inner.getI();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class Inner {
|
||||
private boolean myResult;
|
||||
private int i;
|
||||
|
||||
boolean is() {
|
||||
return myResult;
|
||||
}
|
||||
|
||||
public int getI() {
|
||||
return i;
|
||||
}
|
||||
|
||||
public Inner invoke() {
|
||||
int j;
|
||||
i = 0;
|
||||
j = 1;
|
||||
if (j > 0) {
|
||||
myResult = true;
|
||||
return this;
|
||||
}
|
||||
myResult = false;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user