mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
extract method: allow to extract from fragment with different exit points which all are @NotNull
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
Integer method() {
|
||||
<selection>try {
|
||||
if(cond1) return 0;
|
||||
else if(cond2) return null;
|
||||
System.out.println("Text");
|
||||
} finally {
|
||||
doSomething();
|
||||
}</selection>
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Test {
|
||||
int method() {
|
||||
Integer x = newMethod();
|
||||
if (x != null) return x;
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Integer newMethod() {
|
||||
try {
|
||||
if(cond1) return 0;
|
||||
else if(cond2) return 1;
|
||||
System.out.println("Text");
|
||||
} finally {
|
||||
doSomething();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user