mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
delegate: don't copy override as it would be added explicitly (IDEA-178893)
This commit is contained in:
@@ -163,7 +163,8 @@ public class GenerateDelegateHandler implements LanguageCodeInsightActionHandler
|
||||
stmt = (PsiStatement)CodeStyleManager.getInstance(psiManager.getProject()).reformat(stmt);
|
||||
method.getBody().add(stmt);
|
||||
|
||||
GenerateMembersUtil.copyAnnotations(methodCandidate.getElement().getModifierList(), method.getModifierList(), SuppressWarnings.class.getName());
|
||||
GenerateMembersUtil.copyAnnotations(methodCandidate.getElement().getModifierList(), method.getModifierList(),
|
||||
SuppressWarnings.class.getName(), Override.class.getName());
|
||||
|
||||
if (isMethodStatic || modifierList != null && modifierList.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
PsiUtil.setModifierProperty(method, PsiModifier.STATIC, true);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
interface I {
|
||||
void foo();
|
||||
}
|
||||
class A implements I {
|
||||
@Override
|
||||
public void foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
A a;
|
||||
|
||||
public void foo() {
|
||||
a.foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
interface I {
|
||||
void foo();
|
||||
}
|
||||
class A implements I {
|
||||
@Override
|
||||
public void foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
A a;
|
||||
<caret>
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public class DelegateMethodsTest extends LightCodeInsightTestCase {
|
||||
public void testMultipleOverrideAnnotations() { doTest(); }
|
||||
public void testStripSuppressWarningsAnnotation() { doTest(); }
|
||||
public void testDoNotOverrideFinal() { doTest(); }
|
||||
public void testEnsureCorrectOverride() { doTest(); }
|
||||
public void testAllowDelegateToFinal() { doTest(); }
|
||||
public void testDelegateWithSubstitutionOverrides() { doTest(); }
|
||||
public void testDelegateWithSubstitutionNoOverrides() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user