mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
introduce parameter: clear @Override when delegate (IDEA-153158)
This commit is contained in:
+7
@@ -16,6 +16,7 @@
|
||||
package com.intellij.refactoring.introduceParameter;
|
||||
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.ChangeContextUtil;
|
||||
import com.intellij.codeInsight.generation.GenerateMembersUtil;
|
||||
import com.intellij.lang.findUsages.DescriptiveNameUtil;
|
||||
@@ -416,6 +417,12 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
if (myMethodToSearchFor != myMethodToReplaceIn) {
|
||||
IntroduceParameterUtil.changeMethodSignatureAndResolveFieldConflicts(new UsageInfo(myMethodToSearchFor), usages, this);
|
||||
}
|
||||
else if (myGenerateDelegate && myMethodToReplaceIn.findSuperMethods().length == 0) {
|
||||
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(myMethodToReplaceIn, true, Override.class.getName());
|
||||
if (annotation != null) {
|
||||
annotation.delete();
|
||||
}
|
||||
}
|
||||
ChangeContextUtil.clearContextInfo(myParameterInitializer);
|
||||
|
||||
// Replacing expression occurrences
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
interface Foo {
|
||||
void foobalize();
|
||||
}
|
||||
|
||||
class ExtractTest implements Foo {
|
||||
@Override
|
||||
public void foobalize() {
|
||||
foobalize(42);
|
||||
}
|
||||
|
||||
public void foobalize(int anObject) {
|
||||
System.out.println(anObject);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface Foo {
|
||||
void foobalize();
|
||||
}
|
||||
|
||||
class ExtractTest implements Foo {
|
||||
@Override
|
||||
public void foobalize() {
|
||||
System.out.println(<selection>42</selection>);
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,10 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
|
||||
"Value for introduced parameter in that method call will be incorrect.");
|
||||
}
|
||||
|
||||
public void testRemoveOverrideFromDelegated() throws Exception {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, true);
|
||||
}
|
||||
|
||||
public void testFieldAccess() {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user