mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
extract method object: process exit statements as they may contain refs to outer vars (IDEA-96772); disable duplicate extraction
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
class A {
|
||||
boolean foo() {
|
||||
|
||||
<selection>for (int i = 0; i < 9; i++) {
|
||||
final Boolean foo = Boolean.FALSE;
|
||||
if (foo != null) {
|
||||
return foo;
|
||||
}
|
||||
}</selection>
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
class A {
|
||||
boolean foo() {
|
||||
|
||||
Inner inner = new Inner().invoke();
|
||||
if (inner.is()) return inner.getFoo();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class Inner {
|
||||
private boolean myResult;
|
||||
private Boolean foo;
|
||||
|
||||
boolean is() {
|
||||
return myResult;
|
||||
}
|
||||
|
||||
public Boolean getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public Inner invoke() {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
foo = Boolean.FALSE;
|
||||
if (foo != null) {
|
||||
myResult = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
myResult = false;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user