move members: conflict against members of superclass (IDEA-151440)

This commit is contained in:
Anna Kozlova
2016-02-16 18:59:27 +01:00
parent 3a08734b15
commit bf226f58ab
6 changed files with 50 additions and 10 deletions
@@ -0,0 +1,12 @@
class One {
static boolean truth = true;
static void important() {
System.out.println(1);
}
}
class A extends One {
Two() {
important();
System.out.println(truth);
}
}
@@ -0,0 +1,6 @@
public class B {
static boolean truth = false;
static void important() {
System.out.println(2);
}
}
@@ -0,0 +1,12 @@
class One {
static boolean truth = true;
static void important() {
System.out.println(1);
}
}
class A extends One {
Two() {
important();
System.out.println(truth);
}
}
@@ -0,0 +1,6 @@
public class B {
static boolean truth = false;
static void important() {
System.out.println(2);
}
}
@@ -154,6 +154,17 @@ public class MoveMembersTest extends MultiFileTestCase {
}
}
public void testExistingFieldInSuper() throws Exception {
try {
doTest("B", "A", 0, 1);
fail("conflict expected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
assertEquals("Field <b><code>truth</code></b> already exists in the target class.\n" +
"Method <b><code>important()</code></b> already exists in the target class.", e.getMessage());
}
}
public void testInnerToInterface() throws Exception {
doTest("A", "B", 0);
}