mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
push down from interface to abstract class fixed (IDEA-82286)
This commit is contained in:
@@ -356,11 +356,14 @@ public class PushDownProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
else if (member instanceof PsiMethod) {
|
||||
PsiMethod method = (PsiMethod)member;
|
||||
|
||||
final PsiMethod methodBySignature = targetClass.findMethodBySignature(method, false);
|
||||
if (methodBySignature == null) {
|
||||
final boolean wasInterface = myClass.isInterface();
|
||||
newMember = (PsiMethod)targetClass.add(method);
|
||||
if (memberInfo.isToAbstract()) {
|
||||
if (wasInterface) {
|
||||
PsiUtil.setModifierProperty(newMember, PsiModifier.ABSTRACT, true);
|
||||
PsiUtil.setModifierProperty(newMember, PsiModifier.PUBLIC, true);
|
||||
} else if (memberInfo.isToAbstract()) {
|
||||
if (newMember.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
PsiUtil.setModifierProperty(newMember, PsiModifier.PROTECTED, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
abstract class StraightLine implements Inline {
|
||||
}
|
||||
|
||||
interface Inline {
|
||||
|
||||
void g<caret>o(); // inline this method
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
abstract class StraightLine implements Inline {
|
||||
public abstract void go(); // inline this method
|
||||
}
|
||||
|
||||
interface Inline {
|
||||
|
||||
}
|
||||
@@ -111,6 +111,10 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMethodFromInterfaceToAbstractClass() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSameClassInterface() throws Exception {
|
||||
final String filePath = "/refactoring/pushDown/" + getTestName(false) + ".java";
|
||||
configureByFile(filePath);
|
||||
|
||||
Reference in New Issue
Block a user