Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-09-18 23:44:26 +0000
committerStephan Herrmann2012-09-18 23:44:26 +0000
commit3ff346ae69442fe57a4b12f9fe776b4c471695eb (patch)
tree14295c924472bfdcb6bfab1d83fecdd0215dc2b5 /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring
parenta41522640854ed503aa561e345848207cc597e79 (diff)
downloadorg.eclipse.objectteams-3ff346ae69442fe57a4b12f9fe776b4c471695eb.tar.gz
org.eclipse.objectteams-3ff346ae69442fe57a4b12f9fe776b4c471695eb.tar.xz
org.eclipse.objectteams-3ff346ae69442fe57a4b12f9fe776b4c471695eb.zip
Bug 389850 - [refactoring] change signature fails if role method is
bound in a signature-less callin
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_in.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_out.java10
3 files changed, 38 insertions, 1 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java
index bef867db1..b4c82f84e 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java
@@ -16,6 +16,7 @@
**********************************************************************/
package org.eclipse.objectteams.otdt.ui.tests.refactoring.misc;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -23,6 +24,7 @@ import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IMethod;
@@ -157,7 +159,14 @@ public class ChangeSignatureTests extends RefactoringTest {
private void helperDelete(String[] signature, int[] deleteIndices, boolean createDelegate, String expectedInfo) throws Exception {
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
IType classA= getType(cu, "A");
- IMethod method = classA.getMethod("m", signature);
+ helperDelete(cu, classA, signature, deleteIndices,
+ createDelegate, expectedInfo);
+ }
+
+ void helperDelete(ICompilationUnit cu, IType declaringClass, String[] signature, int[] deleteIndices, boolean createDelegate, String expectedInfo)
+ throws JavaModelException, CoreException, Exception, IOException
+ {
+ IMethod method = declaringClass.getMethod("m", signature);
assertTrue("method does not exist", method.exists());
assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
@@ -308,6 +317,14 @@ public class ChangeSignatureTests extends RefactoringTest {
helperDelete(new String[]{"I", "I"}, deleteIndices, false/*delegate*/, "Deleting arguments at the role side of a callout binding is not fully supported. Please manually update transitive references."/*expectInfo*/);
}
+ // delete argument in role method bound in signature-less callin
+ public void testDelete03()throws Exception{
+ ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
+ IType roleR= getType(cu, "MyTeam").getType("R");
+ int[] deleteIndices= {1};
+ helperDelete(cu, roleR, new String[]{"I", "I"}, deleteIndices, false/*delegate*/, "Affected method binding has no signatures; consider adding signatures first so that the refactoring can absorb incompatible changes using parameter mappings"/*expectInfo*/);
+ }
+
public void testReorder01() throws Exception {
helperPermute(new String[]{"ignore", "b", "a"}, new String[]{"I", "Z", "QString;"}, false);
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_in.java
new file mode 100644
index 000000000..8643509c9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_in.java
@@ -0,0 +1,10 @@
+package p;
+class B {
+ void m(int i, int x) {}
+}
+team class MyTeam {
+ protected class R playedBy B {
+ m <- after m;
+ void m(int i, int x) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_out.java
new file mode 100644
index 000000000..4c6705214
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete03_out.java
@@ -0,0 +1,10 @@
+package p;
+class B {
+ void m(int i, int x) {}
+}
+team class MyTeam {
+ protected class R playedBy B {
+ m <- after m;
+ void m(int i) {}
+ }
+} \ No newline at end of file

Back to the top