mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rename method without super: remove @Override (IDEA-142867)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.ide.util.SuperMethodWarningUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -126,6 +127,13 @@ public class RenameJavaMethodProcessor extends RenameJavaMemberProcessor {
|
||||
}
|
||||
qualifyOuterMemberReferences(outerHides);
|
||||
qualifyStaticImportReferences(staticImportHides);
|
||||
|
||||
if (method.findDeepestSuperMethods().length == 0) {
|
||||
PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, CommonClassNames.JAVA_LANG_OVERRIDE);
|
||||
if (annotation != null && annotation.isPhysical()) {
|
||||
annotation.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package p;
|
||||
class Bar {
|
||||
public void foo() {}
|
||||
}
|
||||
|
||||
class Foo extends Bar {
|
||||
public void bar() {
|
||||
super.foo();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package p;
|
||||
class Bar {
|
||||
public void foo() {}
|
||||
}
|
||||
|
||||
class Foo extends Bar {
|
||||
@Override
|
||||
public void foo() {
|
||||
super.foo();
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,10 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
|
||||
doAutomaticRenameMethod("p.Foo", "void foo()", "bar");
|
||||
}
|
||||
|
||||
public void testOnlyChildMethod() throws Exception {
|
||||
doTest("p.Foo", "void foo()", "bar");
|
||||
}
|
||||
|
||||
private void doTest(final String methodSignature, final String newName) throws Exception {
|
||||
doTest(getTestName(false), methodSignature, newName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user