introduce parameter, delegate: process supermethod accordingly (IDEA-57162)

This commit is contained in:
anna
2010-08-05 15:54:28 +04:00
parent 5b994eb25e
commit 308e0665e1
6 changed files with 93 additions and 6 deletions
@@ -0,0 +1,22 @@
abstract class A {
void xxx() {
xxx(239);
}
abstract void xxx(final int anObject);
}
class B implements A {
public void xxx() {
xxx(239);
}
public void xxx(final int anObject) {
System.out.println(anObject);
}
static {
A a = new B();
a.xxx();
}
}
@@ -0,0 +1,20 @@
interface A {
void xxx();
void xxx(final int anObject);
}
class B implements A {
public void xxx() {
xxx(239);
}
public void xxx(final int anObject) {
System.out.println(anObject);
}
static {
A a = new B();
a.xxx();
}
}
@@ -0,0 +1,14 @@
abstract class A {
abstract void xxx();
}
class B implements A {
public void xxx() {
System.out.println(<selection>239</selection>);
}
static {
A a = new B();
a.xxx();
}
}
@@ -0,0 +1,14 @@
interface A {
void xxx();
}
class B implements A {
public void xxx() {
System.out.println(<selection>239</selection>);
}
static {
A a = new B();
a.xxx();
}
}
@@ -245,6 +245,14 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
public void testGenerateDelegateInSuperClass() throws Exception {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, true, true, true);
}
public void testGenerateDelegateInSuperInterface() throws Exception {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, true, true, true);
}
private void doTestThroughHandler() throws Exception {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
new IntroduceParameterHandler().invoke(getProject(), myEditor, myFile, new DataContext() {