change signature: add warning if new signature duplicates method in overrider (IDEA-157659)

This commit is contained in:
Anna Kozlova
2016-06-30 21:02:38 +03:00
parent 7d48d00ae9
commit 4b1ff8c516
3 changed files with 25 additions and 6 deletions
@@ -0,0 +1,8 @@
class A {
void fo<caret>o() {}
}
class B extends A {
void foo() {}
void foo(int i) {}
}
@@ -60,6 +60,14 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
}
public void testDuplicatedSignatureInInheritor() throws Exception {
try {
doTest(null, new ParameterInfoImpl[] {new ParameterInfoImpl(-1, "i", PsiType.INT)}, true);
fail("Conflict expected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
}
public void testGenericTypes() {
doTest(null, null, "T", method -> new ParameterInfoImpl[]{
new ParameterInfoImpl(-1, "x", myFactory.createTypeFromText("T", method.getParameterList()), "null"),