summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaksha Vasisht2012-04-29 09:49:32 (EDT)
committer Markus Keller2012-04-29 09:49:32 (EDT)
commite8916689f7d263178595c0fc6eb17f047c0a9109 (patch)
tree50153e212787f60a5871c0afa19fa36e38e0521f
parentb0c3b403fb971af242b9d5ac876b884f271b259f (diff)
downloadeclipse.jdt.ui-e8916689f7d263178595c0fc6eb17f047c0a9109.zip
eclipse.jdt.ui-e8916689f7d263178595c0fc6eb17f047c0a9109.tar.gz
eclipse.jdt.ui-e8916689f7d263178595c0fc6eb17f047c0a9109.tar.bz2
Bug 339980: [move method] Move method adds enum name to case statementsv20120429-1349
Test cases
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/in/A.java23
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/out/A.java23
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/A.java21
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/MyEnum.java5
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/A.java11
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/MyEnum.java15
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/in/A.java24
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/out/A.java24
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java15
9 files changed, 161 insertions, 0 deletions
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/in/A.java
new file mode 100644
index 0000000..6fcbd27
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/in/A.java
@@ -0,0 +1,23 @@
+package p;
+
+public class A {
+ B someField;
+
+ enum MyEnum {
+ FOO, BAR
+ }
+
+ void someMethod(MyEnum fooBar) {
+ switch (fooBar) {
+ case FOO:
+ System.out.println("foo");
+ break;
+ case BAR:
+ System.out.println("bar");
+ }
+ }
+}
+
+class B {
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/out/A.java
new file mode 100644
index 0000000..347c5bf
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test43/out/A.java
@@ -0,0 +1,23 @@
+package p;
+
+public class A {
+ B someField;
+
+ enum MyEnum {
+ FOO, BAR;
+
+ void someMethod() {
+ switch (this) {
+ case FOO:
+ System.out.println("foo");
+ break;
+ case BAR:
+ System.out.println("bar");
+ }
+ }
+ }
+}
+
+class B {
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/A.java
new file mode 100644
index 0000000..e704ee1
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/A.java
@@ -0,0 +1,21 @@
+package p;
+
+public class A {
+ B someField;
+ static int a;
+ String b;
+
+ void someMethod(MyEnum fooBar) {
+ switch (fooBar) {
+ case FOO:
+ System.out.println(a);
+ break;
+ case BAR:
+ System.out.println(b);
+ }
+ }
+}
+
+class B {
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/MyEnum.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/MyEnum.java
new file mode 100644
index 0000000..5f38e65
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/in/MyEnum.java
@@ -0,0 +1,5 @@
+package p;
+
+enum MyEnum {
+ FOO, BAR
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/A.java
new file mode 100644
index 0000000..06daca1
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/A.java
@@ -0,0 +1,11 @@
+package p;
+
+public class A {
+ B someField;
+ static int a;
+ String b;
+}
+
+class B {
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/MyEnum.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/MyEnum.java
new file mode 100644
index 0000000..490d2ad
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test44/out/MyEnum.java
@@ -0,0 +1,15 @@
+package p;
+
+enum MyEnum {
+ FOO, BAR;
+
+ void someMethod(A a) {
+ switch (this) {
+ case FOO:
+ System.out.println(A.a);
+ break;
+ case BAR:
+ System.out.println(a.b);
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/in/A.java
new file mode 100644
index 0000000..165a77b
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/in/A.java
@@ -0,0 +1,24 @@
+package p;
+
+public class A extends B{
+ B someField;
+ static int a;
+ String b;
+
+ void someMethod(MyEnum fooBar) {
+ switch (fooBar) {
+ case FOO:
+ System.out.println(a);
+ break;
+ case BAR:
+ System.out.println(b);
+ System.out.println(someField);
+ }
+ }
+}
+
+class B {
+ enum MyEnum {
+ FOO, BAR
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/out/A.java
new file mode 100644
index 0000000..1f2f9b9
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test45/out/A.java
@@ -0,0 +1,24 @@
+package p;
+
+public class A extends B{
+ B someField;
+ static int a;
+ String b;
+}
+
+class B {
+ enum MyEnum {
+ FOO, BAR;
+
+ void someMethod(A a) {
+ switch (this) {
+ case FOO:
+ System.out.println(A.a);
+ break;
+ case BAR:
+ System.out.println(a.b);
+ System.out.println(a.someField);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
index ad2d8e7..523d563 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
@@ -445,6 +445,21 @@ public class MoveInstanceMethodTests extends RefactoringTest {
helper1(new String[] { "p.A", "p.B", "p.Outer" }, "p.A", 6, 17, 6, 20, PARAMETER, "b", true, true);
}
+ // Test problem with enum (bug 339980)
+ public void test43() throws Exception {
+ helper1(new String[] { "p.A" }, "p.A", 10, 10, 10, 20, PARAMETER, "fooBar", true, true);
+ }
+
+ // Test problem with enum (bug 339980)
+ public void test44() throws Exception {
+ helper1(new String[] { "p.A", "p.MyEnum" }, "p.A", 8, 10, 8, 20, PARAMETER, "fooBar", true, true);
+ }
+
+ // Test problem with enum (bug 339980)
+ public void test45() throws Exception {
+ helper1(new String[] { "p.A" }, "p.A", 8, 10, 8, 20, PARAMETER, "fooBar", true, true);
+ }
+
// Move mA1 to field fB, do not inline delegator
public void test3() throws Exception {
helper1(new String[] { "p1.A", "p2.B", "p3.C"}, "p1.A", 9, 17, 9, 20, FIELD, "fB", false, false);