cleanup to setter-less

This commit is contained in:
Alexey Kudravtsev
2018-09-14 16:01:02 +03:00
parent 07e1cf805e
commit abb176a63a
7 changed files with 12 additions and 64 deletions
@@ -116,13 +116,7 @@ public class ChangeSignatureGestureTest extends LightCodeInsightFixtureTestCase
}
public void testDeleteParamInSuperUsed() {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doDeleteTest();
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(() -> doDeleteTest());
}
private void doDeleteTest() {
@@ -265,13 +265,9 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
}
public void testRemoveVarargParameter() {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doTest(null, null, null, new ParameterInfoImpl[]{new ParameterInfoImpl(0)}, new ThrownExceptionInfo[0], false);
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->
doTest(null, null, null, new ParameterInfoImpl[]{new ParameterInfoImpl(0)}, new ThrownExceptionInfo[0], false)
);
}
public void testEnumConstructor() {
@@ -88,13 +88,7 @@ public class ExtractClassTest extends MultiFileTestCase {
}
public void testIncrement() {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doTestField(null, false);
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doTestField(null, false));
}
public void testVarargs() {
@@ -163,13 +163,7 @@ public class SafeDeleteTest extends MultiFileTestCase {
}
public void testRemoveOverridersInspiteOfUnsafeUsages() {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doTest("A");
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doTest("A"));
}
public void testLocalVariable() {
@@ -331,13 +325,7 @@ public class SafeDeleteTest extends MultiFileTestCase {
public void testParameterInMethodUsedInMethodReference() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doSingleFileTest();
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doSingleFileTest());
}
public void testNoConflictOnDeleteParameterWithMethodRefArg() throws Exception {
@@ -346,13 +334,7 @@ public class SafeDeleteTest extends MultiFileTestCase {
}
public void testShowConflictsButRemoveAnnotationsIfAnnotationTypeIsDeleted() throws Exception {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doSingleFileTest();
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doSingleFileTest());
}
public void testUsagesInScratch() throws Exception {
@@ -110,13 +110,7 @@ public class InlineMethodTest extends LightRefactoringTestCase {
public void testChainingConstructor() { doTest(); }
public void testChainingConstructor1() {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
try {
doTest();
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doTest());
}
public void testNestedCall() { doTest(); }
@@ -129,13 +129,7 @@ public class MoveInstanceMethodTest extends LightRefactoringTestCase {
}
public void testParameterMethodReference() {
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doTest(true, 0);
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doTest(true, 0));
}
private void doTest(boolean isTargetParameter, final int targetIndex) {
@@ -42,7 +42,6 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.Factory;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.registry.Registry;
@@ -89,7 +88,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
private RefactoringTransaction myTransaction;
private boolean myIsPreviewUsages;
protected Runnable myPrepareSuccessfulSwingThreadCallback = EmptyRunnable.INSTANCE;
protected Runnable myPrepareSuccessfulSwingThreadCallback;
protected BaseRefactoringProcessor(@NotNull Project project) {
this(project, null);
@@ -578,17 +577,12 @@ public abstract class BaseRefactoringProcessor implements Runnable {
this.messages = messages;
}
@TestOnly
public static void setTestIgnore(boolean myIgnore) {
myTestIgnore = myIgnore;
}
public static boolean isTestIgnore() {
return myTestIgnore;
}
@TestOnly
public static <T extends Throwable> void withIgnoredConflicts(ThrowableRunnable<T> r) throws T {
public static <T extends Throwable> void withIgnoredConflicts(@NotNull ThrowableRunnable<T> r) throws T {
try {
myTestIgnore = true;
r.run();