mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-refactoring] IDEA-350228 Missing method body after moving an instance method from interface to non-abstract class
GitOrigin-RevId: a54261f44b8e07273962d3c8c6c2a3db62d6fccf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
11a73992ad
commit
d34e599418
+6
@@ -2,6 +2,7 @@
|
||||
package com.intellij.refactoring.move.moveInstanceMethod;
|
||||
|
||||
import com.intellij.codeInsight.ChangeContextUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.CreateFromUsageUtils;
|
||||
import com.intellij.codeInsight.generation.OverrideImplementUtil;
|
||||
import com.intellij.ide.util.EditorHelper;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
@@ -460,6 +461,11 @@ public class MoveInstanceMethodProcessor extends BaseRefactoringProcessor{
|
||||
final PsiCodeBlock body = myMethod.getBody();
|
||||
if (body != null) {
|
||||
replaceReferences(body);
|
||||
} else {
|
||||
if (myMethod.hasModifierProperty(PsiModifier.ABSTRACT) &&
|
||||
!myTargetClass.isInterface() && !myTargetClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
CreateFromUsageUtils.setupMethodBody(myMethod);
|
||||
}
|
||||
}
|
||||
|
||||
final PsiMethod methodCopy = getPatternMethod();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
public interface A {
|
||||
|
||||
public void n(A a);
|
||||
|
||||
public void <caret>m(B b);
|
||||
}
|
||||
|
||||
class B {
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
|
||||
public interface A {
|
||||
|
||||
public void n(A a);
|
||||
|
||||
}
|
||||
|
||||
class B {
|
||||
|
||||
public void m() {
|
||||
}
|
||||
}
|
||||
+4
@@ -104,6 +104,10 @@ public class MoveInstanceMethodTest extends LightRefactoringTestCase {
|
||||
public void testUsageInAnonymousClass() {
|
||||
doTest(true, 0);
|
||||
}
|
||||
|
||||
public void testInterfaceMethodIntoClass() {
|
||||
doTest(true, 0);
|
||||
}
|
||||
|
||||
public void testConflictingLocalVariableAndTargetClassField() {
|
||||
doTest(true, 0);
|
||||
|
||||
Reference in New Issue
Block a user