change signature: conflict if deleted parameter is used in method body, excluding javadoc (IDEA-157603)

This commit is contained in:
Anna Kozlova
2016-06-30 21:02:38 +03:00
parent 4b1ff8c516
commit fe7045debb
7 changed files with 67 additions and 5 deletions
@@ -0,0 +1,9 @@
class A {
void f<caret>oo(int i) {}
}
class B extends A {
void foo(int i) {
System.out.println(i);
}
}
@@ -169,7 +169,13 @@ public class ChangeSignatureGestureTest extends LightCodeInsightFixtureTestCase
}
public void testDeleteParamInSuperUsed() {
doDeleteTest();
try {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(true);
doDeleteTest();
}
finally {
BaseRefactoringProcessor.ConflictsInTestsException.setTestIgnore(false);
}
}
private void doDeleteTest() {
@@ -68,6 +68,14 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
}
public void testConflictForUsedParametersInMethodBody() throws Exception {
try {
doTest(null, new ParameterInfoImpl[0], 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"),