[extract method] fix test data

GitOrigin-RevId: 4d64e2fced6e7b3c87b1361de36909fec8d7db0a
This commit is contained in:
Alexandr Suhinin
2020-03-31 12:32:01 +00:00
committed by intellij-monorepo-bot
parent 5ab38e68cc
commit c7b05d5f55
9 changed files with 51 additions and 31 deletions
@@ -10,7 +10,7 @@ class C {
}
@NotNull
private Object newMethod() {
private A newMethod() {
return A.getInstance();
}
}
@@ -1,4 +1,4 @@
// multiple output values: one for modelling control flow + output value
// nullable variable with flow statement
class K {
int f(Object o) {
<selection>if (o == null) return 0;
@@ -0,0 +1,19 @@
import org.jetbrains.annotations.Nullable;
// nullable variable with flow statement
class K {
int f(Object o) {
o = newMethod(o);
if (o == null) return 0;
Object oo = o;
return 1;
}
@Nullable
private Object newMethod(Object o) {
if (o == null) return null;
o = new Object();
return o;
}
}
@@ -1,17 +1,17 @@
class Test {
private static void f(boolean a, boolean b) {
if (a) {
<selection>try {
System.out.println();
return;
}
catch (Exception e) {
return;
}</selection>
} else {
System.out.println("");
private static void f(boolean a, boolean b) {
if (a) {
<selection>try {
System.out.println();
return;
}
catch (Exception e) {
return;
}</selection>
} else {
System.out.println("");
}
}
}
}
@@ -1,21 +1,20 @@
class Test {
private static void f(boolean a, boolean b) {
if (a) {
newMethod();
return;
} else {
System.out.println("");
private static void f(boolean a, boolean b) {
if (a) {
newMethod();
} else {
System.out.println("");
}
}
}
private static void newMethod() {
try {
System.out.println();
return;
System.out.println();
return;
}
catch (Exception e) {
return;
return;
}
}
@@ -9,7 +9,7 @@ class B {
}
}
private void newMethod() {
private static void newMethod() {
System.out.println();
}
}
@@ -6,13 +6,12 @@ public class Foo {
public String toString() {
return newMethod();
}
};
},
f2 = new Foo(){};
@NotNull
private static String newMethod() {
return "a" + "b";
}
static Foo f2 = new Foo(){};
}
@@ -1,5 +1,7 @@
package extractMethod;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.util.Iterator;
@@ -7,9 +9,9 @@ public class SCR27887 {
public int publishx(OutputStream out, boolean includeCode) throws IOException {
if (VERBOSE) System.err.println("PUBLISH: publishing subsystem '" + subsystem.refQualifiedIdentifyingName() + "' with" + (includeCode ? "" : "out") + " code");
ZippingXMLGeneratorFactory genFac = new ZippingXMLGeneratorFactory(out);
//========
//========
RefObjectUList included = newMethod(genFac);
//========
//========
if (includeCode) {
for (Iterator i = subsystem.getModule().iterator(); i.hasNext();) {
OptimalModule module = (OptimalModule) i.next();
@@ -35,6 +37,7 @@ public class SCR27887 {
return included.size();
}
@NotNull
private RefObjectUList newMethod(ZippingXMLGeneratorFactory genFac) {
RefObjectUList included = makeIncludedSet();
if (!included.isEmpty()) {
@@ -73,7 +73,7 @@ public class ExtractMethodNewTest extends LightJavaCodeInsightTestCase {
}
public void testExitPoints6() throws Exception {
doExitPointsTest(false);
doTest();
}
public void testExitPoints7() throws Exception {