mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
push down: preserve @Override if keep abstract was selected (IDEA-155600)
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
interface Test {
|
||||
/**
|
||||
* some javadoc
|
||||
*/
|
||||
default void foo() {
|
||||
System.out.println("I");
|
||||
}
|
||||
}
|
||||
|
||||
class C implements Test {
|
||||
/**
|
||||
* another javadoc
|
||||
*/
|
||||
@Override
|
||||
public void foo() {
|
||||
System.out.println("C");
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
interface Test {
|
||||
/**
|
||||
* some javadoc
|
||||
*/
|
||||
void foo();
|
||||
}
|
||||
|
||||
class C implements Test {
|
||||
/**
|
||||
* another javadoc
|
||||
*/
|
||||
@Override
|
||||
public void foo() {
|
||||
System.out.println("C");
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,10 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
doTestImplements(true);
|
||||
}
|
||||
|
||||
public void testPreserveOverrideAnnotationAfterConflict() throws Exception {
|
||||
doTestImplements(true, true);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
@@ -135,7 +139,7 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
new DocCommentPolicy(DocCommentPolicy.ASIS)) {
|
||||
@Override
|
||||
protected boolean showConflicts(@NotNull MultiMap<PsiElement, String> conflicts, UsageInfo[] usages) {
|
||||
if (failure ? conflicts.isEmpty() : !conflicts.isEmpty()) {
|
||||
if (failure == conflicts.isEmpty()) {
|
||||
fail(failure ? "Conflict was not detected" : "False conflict was detected");
|
||||
}
|
||||
return true;
|
||||
@@ -150,6 +154,10 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
}
|
||||
|
||||
private void doTestImplements(boolean toAbstract) {
|
||||
doTestImplements(toAbstract, false);
|
||||
}
|
||||
|
||||
private void doTestImplements(boolean toAbstract, boolean failure) {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
|
||||
PsiClass currentClass = JavaPsiFacade.getInstance(getProject()).findClass("Test", GlobalSearchScope.projectScope(getProject()));
|
||||
@@ -166,6 +174,9 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
new DocCommentPolicy(DocCommentPolicy.ASIS)) {
|
||||
@Override
|
||||
protected boolean showConflicts(@NotNull MultiMap<PsiElement, String> conflicts, UsageInfo[] usages) {
|
||||
if (failure == conflicts.isEmpty()) {
|
||||
fail(failure ? "Conflict was not detected" : "False conflict was detected");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}.run();
|
||||
|
||||
Reference in New Issue
Block a user