mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-28 21:30:23 +07:00
extract method: don't skip vars from the exit statements if nullable checks would be added (IDEA-141562)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
class X {
|
||||
static String guessTestDataName(String method, String testName, String[] methods) {
|
||||
for (String psiMethod : methods) {
|
||||
<selection>String strings = method;
|
||||
if (strings != null && !strings.isEmpty()) {
|
||||
return strings.substring(0) + testName;
|
||||
}
|
||||
</selection>
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class X {
|
||||
static String guessTestDataName(String method, String testName, String[] methods) {
|
||||
for (String psiMethod : methods) {
|
||||
String strings = newMethod(method, testName);
|
||||
if (strings != null) return strings;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String newMethod(String method, String testName) {
|
||||
String strings = method;
|
||||
if (strings != null && !strings.isEmpty()) {
|
||||
return strings.substring(0) + testName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ public class Test {
|
||||
}
|
||||
|
||||
private boolean newMethod() {
|
||||
Object result;
|
||||
if (test1()) return true;
|
||||
if (test2()) return true;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user