Lines 1-15
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2004 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Common Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/cpl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.ui.tests.refactoring; |
11 |
package org.eclipse.jdt.ui.tests.refactoring; |
12 |
|
12 |
|
|
|
13 |
import java.io.IOException; |
13 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
14 |
import java.util.Arrays; |
15 |
import java.util.Arrays; |
15 |
import java.util.Iterator; |
16 |
import java.util.Iterator; |
Lines 27-32
Link Here
|
27 |
import org.eclipse.jdt.core.IMethod; |
28 |
import org.eclipse.jdt.core.IMethod; |
28 |
import org.eclipse.jdt.core.IPackageFragment; |
29 |
import org.eclipse.jdt.core.IPackageFragment; |
29 |
import org.eclipse.jdt.core.IType; |
30 |
import org.eclipse.jdt.core.IType; |
|
|
31 |
import org.eclipse.jdt.core.JavaModelException; |
30 |
import org.eclipse.jdt.core.dom.Modifier; |
32 |
import org.eclipse.jdt.core.dom.Modifier; |
31 |
|
33 |
|
32 |
import org.eclipse.jdt.internal.corext.refactoring.ExceptionInfo; |
34 |
import org.eclipse.jdt.internal.corext.refactoring.ExceptionInfo; |
Lines 79-94
Link Here
|
79 |
return fileName + ".java"; |
81 |
return fileName + ".java"; |
80 |
} |
82 |
} |
81 |
|
83 |
|
82 |
private String getTestFileName(boolean canReorder, boolean input){ |
84 |
private String getTestFileName(boolean canReorder, boolean input, boolean leaveStub){ |
83 |
String fileName= TEST_PATH_PREFIX + getRefactoringPath(); |
85 |
String fileName= TEST_PATH_PREFIX + getRefactoringPath(); |
84 |
fileName += (canReorder ? "canModify/": "cannotModify/"); |
86 |
fileName += (canReorder ? "canModify/": "cannotModify/"); |
85 |
return fileName + getSimpleTestFileName(canReorder, input); |
87 |
return fileName + getSimpleTestFileName(canReorder, input); |
86 |
} |
88 |
} |
87 |
|
89 |
|
88 |
//---helpers |
90 |
//---helpers |
89 |
|
91 |
|
90 |
protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input) throws Exception { |
92 |
protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input) throws Exception { |
91 |
return createCU(pack, getSimpleTestFileName(canRename, input), getFileContents(getTestFileName(canRename, input))); |
93 |
return createCUfromTestFile(pack, canRename, input, false); |
|
|
94 |
} |
95 |
|
96 |
protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input, boolean leaveStub) throws Exception { |
97 |
return createCU(pack, getSimpleTestFileName(canRename, input), getFileContents(getTestFileName(canRename, input, leaveStub))); |
92 |
} |
98 |
} |
93 |
|
99 |
|
94 |
private static ParameterInfo[] createNewParamInfos(String[] newTypes, String[] newNames, String[] newDefaultValues) { |
100 |
private static ParameterInfo[] createNewParamInfos(String[] newTypes, String[] newNames, String[] newDefaultValues) { |
Lines 111-124
Link Here
|
111 |
list.add(newIndices[i], newParamInfos[i]); |
117 |
list.add(newIndices[i], newParamInfos[i]); |
112 |
} |
118 |
} |
113 |
} |
119 |
} |
114 |
|
120 |
|
115 |
private void helperAdd(String[] signature, ParameterInfo[] newParamInfos, int[] newIndices) throws Exception { |
121 |
private void helperAdd(String[] signature, ParameterInfo[] newParamInfo, int[] newIndices) throws Exception { |
|
|
122 |
helperAdd(signature, newParamInfo, newIndices, false, true); |
123 |
} |
124 |
|
125 |
private void helperAdd(String[] signature, ParameterInfo[] newParamInfo, int[] newIndices, boolean leaveStub) throws Exception { |
126 |
helperAdd(signature, newParamInfo, newIndices, leaveStub, true); |
127 |
} |
128 |
|
129 |
private void helperAdd(String[] signature, ParameterInfo[] newParamInfos, int[] newIndices, boolean leaveStub, boolean propogateChanges) throws Exception { |
116 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
130 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
117 |
IType classA= getType(cu, "A"); |
131 |
IType classA= getType(cu, "A"); |
118 |
IMethod method = classA.getMethod("m", signature); |
132 |
IMethod method = classA.getMethod("m", signature); |
119 |
assertTrue("method does not exist", method.exists()); |
133 |
assertTrue("method does not exist", method.exists()); |
120 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
134 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
121 |
addInfos(ref.getParameterInfos(), newParamInfos, newIndices); |
135 |
addInfos(ref.getParameterInfos(), newParamInfos, newIndices); |
|
|
136 |
ref.setLeaveStub(leaveStub); |
137 |
ref.setTagAsDeprecated(propogateChanges); |
138 |
ref.setUpdateReferences(propogateChanges); |
122 |
RefactoringStatus result= performRefactoring(ref); |
139 |
RefactoringStatus result= performRefactoring(ref); |
123 |
assertEquals("precondition was supposed to pass", null, result); |
140 |
assertEquals("precondition was supposed to pass", null, result); |
124 |
|
141 |
|
Lines 126-144
Link Here
|
126 |
String newCuName= getSimpleTestFileName(true, true); |
143 |
String newCuName= getSimpleTestFileName(true, true); |
127 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
144 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
128 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
145 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
129 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
146 |
String expectedFileContents= getFileContents(getTestFileName(true, false, false)); |
130 |
assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource()); |
147 |
assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource()); |
131 |
} |
148 |
} |
132 |
|
149 |
|
133 |
/* |
150 |
/* |
134 |
* Rename method 'A.m(signature)' to 'A.newMethodName(signature)' |
151 |
* Rename method 'A.m(signature)' to 'A.newMethodName(signature)' |
135 |
*/ |
152 |
*/ |
136 |
private void helperRenameMethod(String[] signature, String newMethodName) throws Exception { |
153 |
private void helperRenameMethod(String[] signature, String newMethodName, boolean leaveStub) throws Exception { |
137 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
154 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
138 |
IType classA= getType(cu, "A"); |
155 |
IType classA= getType(cu, "A"); |
139 |
IMethod method = classA.getMethod("m", signature); |
156 |
IMethod method = classA.getMethod("m", signature); |
140 |
assertTrue("method m does not exist in A", method.exists()); |
157 |
assertTrue("method m does not exist in A", method.exists()); |
141 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
158 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
|
|
159 |
ref.setLeaveStub(leaveStub); |
142 |
ref.setNewMethodName(newMethodName); |
160 |
ref.setNewMethodName(newMethodName); |
143 |
RefactoringStatus result= performRefactoring(ref); |
161 |
RefactoringStatus result= performRefactoring(ref); |
144 |
assertEquals("precondition was supposed to pass", null, result); |
162 |
assertEquals("precondition was supposed to pass", null, result); |
Lines 147-157
Link Here
|
147 |
String newCuName= getSimpleTestFileName(true, true); |
165 |
String newCuName= getSimpleTestFileName(true, true); |
148 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
166 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
149 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
167 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
150 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
168 |
String expectedFileContents= getFileContents(getTestFileName(true, false, false)); |
151 |
assertEqualLines("invalid change of method name", expectedFileContents, newcu.getSource()); |
169 |
assertEqualLines("invalid change of method name", expectedFileContents, newcu.getSource()); |
152 |
} |
170 |
} |
153 |
|
171 |
|
154 |
private void helperDoAll(String typeName, |
172 |
private void helperDoAll(String typeName, |
|
|
173 |
String methodName, |
174 |
String[] signature, |
175 |
ParameterInfo[] newParamInfos, |
176 |
int[] newIndices, |
177 |
String[] oldParamNames, |
178 |
String[] newParamNames, |
179 |
String[] newParameterTypeNames, |
180 |
int[] permutation, |
181 |
int newVisibility, |
182 |
int[] deleted, String returnTypeName) throws Exception { |
183 |
helperDoAll( typeName, |
184 |
methodName, |
185 |
signature, |
186 |
newParamInfos, |
187 |
newIndices, |
188 |
oldParamNames, |
189 |
newParamNames, |
190 |
newParameterTypeNames, |
191 |
permutation, |
192 |
newVisibility, |
193 |
deleted, returnTypeName, false, false, true); |
194 |
} |
195 |
|
196 |
private void helperDoAll(String typeName, |
155 |
String methodName, |
197 |
String methodName, |
156 |
String[] signature, |
198 |
String[] signature, |
157 |
ParameterInfo[] newParamInfos, |
199 |
ParameterInfo[] newParamInfos, |
Lines 161-168
Link Here
|
161 |
String[] newParameterTypeNames, |
203 |
String[] newParameterTypeNames, |
162 |
int[] permutation, |
204 |
int[] permutation, |
163 |
int newVisibility, |
205 |
int newVisibility, |
164 |
int[] deleted, String returnTypeName) throws Exception{ |
206 |
int[] deleted, String returnTypeName, |
165 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
207 |
boolean leaveStub, |
|
|
208 |
boolean leaveBody, boolean updateReferences) throws Exception{ |
209 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true, leaveStub); |
166 |
IType classA= getType(cu, typeName); |
210 |
IType classA= getType(cu, typeName); |
167 |
IMethod method = classA.getMethod(methodName, signature); |
211 |
IMethod method = classA.getMethod(methodName, signature); |
168 |
assertTrue("method " + methodName +" does not exist", method.exists()); |
212 |
assertTrue("method " + methodName +" does not exist", method.exists()); |
Lines 173-178
Link Here
|
173 |
modifyInfos(ref.getParameterInfos(), newParamInfos, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation); |
217 |
modifyInfos(ref.getParameterInfos(), newParamInfos, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation); |
174 |
if (newVisibility != JdtFlags.VISIBILITY_CODE_INVALID) |
218 |
if (newVisibility != JdtFlags.VISIBILITY_CODE_INVALID) |
175 |
ref.setVisibility(newVisibility); |
219 |
ref.setVisibility(newVisibility); |
|
|
220 |
ref.setLeaveStub(leaveStub); |
221 |
ref.setLeaveBody(leaveBody); |
222 |
ref.setUpdateReferences(updateReferences); |
223 |
ref.setTagAsDeprecated(updateReferences); |
176 |
RefactoringStatus result= performRefactoring(ref); |
224 |
RefactoringStatus result= performRefactoring(ref); |
177 |
assertEquals("precondition was supposed to pass", null, result); |
225 |
assertEquals("precondition was supposed to pass", null, result); |
178 |
|
226 |
|
Lines 180-186
Link Here
|
180 |
String newCuName= getSimpleTestFileName(true, true); |
228 |
String newCuName= getSimpleTestFileName(true, true); |
181 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
229 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
182 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
230 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
183 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
231 |
String expectedFileContents= getFileContents(getTestFileName(true, false, leaveStub)); |
184 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
232 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
185 |
} |
233 |
} |
186 |
|
234 |
|
Lines 197-217
Link Here
|
197 |
} |
245 |
} |
198 |
|
246 |
|
199 |
private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames) throws Exception{ |
247 |
private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames) throws Exception{ |
|
|
248 |
helper1(newOrder, signature, oldNames, newNames, false); |
249 |
} |
250 |
|
251 |
private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames, boolean leaveStub) throws Exception, JavaModelException, IOException { |
252 |
helper1(newOrder, signature, oldNames, newNames, leaveStub, false); |
253 |
} |
254 |
|
255 |
private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames, boolean leaveStub, boolean leaveBody) throws Exception, JavaModelException, IOException { |
200 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
256 |
ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true); |
201 |
IType classA= getType(cu, "A"); |
257 |
IType classA= getType(cu, "A"); |
202 |
IMethod method = classA.getMethod("m", signature); |
258 |
IMethod method = classA.getMethod("m", signature); |
203 |
assertTrue("method does not exist", method.exists()); |
259 |
assertTrue("method must exist", method.exists()); |
204 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
260 |
ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method); |
205 |
modifyInfos(ref.getParameterInfos(), newOrder, oldNames, newNames); |
261 |
modifyInfos(ref.getParameterInfos(), newOrder, oldNames, newNames); |
|
|
262 |
ref.setLeaveStub(leaveStub); |
263 |
ref.setLeaveBody(leaveBody); |
206 |
RefactoringStatus result= performRefactoring(ref); |
264 |
RefactoringStatus result= performRefactoring(ref); |
207 |
assertEquals("precondition was supposed to pass", null, result); |
265 |
assertEquals("precondition was supposed to pass", null, result); |
208 |
|
|
|
209 |
IPackageFragment pack= (IPackageFragment)cu.getParent(); |
266 |
IPackageFragment pack= (IPackageFragment)cu.getParent(); |
210 |
String newCuName= getSimpleTestFileName(true, true); |
267 |
String newCuName= getSimpleTestFileName(true, true); |
211 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
268 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
212 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
269 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
213 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
270 |
String expectedFileContents= getFileContents(getTestFileName(true, false, leaveStub)); |
214 |
// assertEquals("invalid renaming", expectedFileContents, newcu.getSource()); |
271 |
// assertEquals("invalid renaming", expectedFileContents, newcu.getSource()); |
215 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
272 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
216 |
} |
273 |
} |
217 |
|
274 |
|
Lines 377-383
Link Here
|
377 |
String newCuName= getSimpleTestFileName(true, true); |
434 |
String newCuName= getSimpleTestFileName(true, true); |
378 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
435 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
379 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
436 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
380 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
437 |
String expectedFileContents= getFileContents(getTestFileName(true, false, false)); |
381 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
438 |
assertEqualLines(expectedFileContents, newcu.getSource()); |
382 |
} |
439 |
} |
383 |
|
440 |
|
Lines 404-410
Link Here
|
404 |
String newCuName= getSimpleTestFileName(true, true); |
461 |
String newCuName= getSimpleTestFileName(true, true); |
405 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
462 |
ICompilationUnit newcu= pack.getCompilationUnit(newCuName); |
406 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
463 |
assertTrue(newCuName + " does not exist", newcu.exists()); |
407 |
String expectedFileContents= getFileContents(getTestFileName(true, false)); |
464 |
String expectedFileContents= getFileContents(getTestFileName(true, false, false)); |
408 |
assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource()); |
465 |
assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource()); |
409 |
} |
466 |
} |
410 |
|
467 |
|
Lines 710-739
Link Here
|
710 |
} |
767 |
} |
711 |
|
768 |
|
712 |
public void test15() throws Exception{ |
769 |
public void test15() throws Exception{ |
713 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
770 |
//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
|
|
771 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true); |
714 |
} |
772 |
} |
715 |
|
773 |
|
716 |
public void test16() throws Exception{ |
774 |
public void test16() throws Exception{ |
717 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
775 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true); |
718 |
} |
776 |
} |
719 |
|
777 |
|
720 |
public void test17() throws Exception{ |
778 |
public void test17() throws Exception{ |
721 |
//exception because of bug 11151 |
779 |
//exception because of bug 11151 |
722 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
780 |
//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
|
|
781 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true); |
723 |
} |
782 |
} |
724 |
|
783 |
|
725 |
public void test18() throws Exception{ |
784 |
public void test18() throws Exception{ |
726 |
//exception because of bug 11151 |
785 |
//exception because of bug 11151 |
727 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
786 |
//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
|
|
787 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true); |
728 |
} |
788 |
} |
729 |
|
789 |
|
730 |
public void test19() throws Exception{ |
790 |
public void test19() throws Exception{ |
731 |
// printTestDisabledMessage("bug 7274 - reorder parameters: incorrect when parameters have more than 1 modifiers"); |
791 |
// printTestDisabledMessage("bug 7274 - reorder parameters: incorrect when parameters have more than 1 modifiers"); |
732 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
792 |
//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
|
|
793 |
helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true); |
733 |
} |
794 |
} |
734 |
public void test20() throws Exception{ |
795 |
public void test20() throws Exception{ |
735 |
// printTestDisabledMessage("bug 18147"); |
796 |
// printTestDisabledMessage("bug 18147"); |
736 |
helper1(new String[]{"b", "a"}, new String[]{"I", "[I"}); |
797 |
// helper1(new String[]{"b", "i"}, new String[]{"I", "Z"}); |
|
|
798 |
helper1(new String[]{"b", "a"}, new String[]{"I", "[I"},null,null,true); |
737 |
} |
799 |
} |
738 |
|
800 |
|
739 |
//constructor tests |
801 |
//constructor tests |
Lines 754-759
Link Here
|
754 |
String newReturnTypeName= null; |
816 |
String newReturnTypeName= null; |
755 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName); |
817 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName); |
756 |
} |
818 |
} |
|
|
819 |
|
757 |
public void test22() throws Exception{ |
820 |
public void test22() throws Exception{ |
758 |
if (! RUN_CONSTRUCTOR_TEST){ |
821 |
if (! RUN_CONSTRUCTOR_TEST){ |
759 |
printTestDisabledMessage("disabled for constructors for now"); |
822 |
printTestDisabledMessage("disabled for constructors for now"); |
Lines 771-776
Link Here
|
771 |
String newReturnTypeName= null; |
834 |
String newReturnTypeName= null; |
772 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName); |
835 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName); |
773 |
} |
836 |
} |
|
|
837 |
|
774 |
public void test23() throws Exception{ |
838 |
public void test23() throws Exception{ |
775 |
if (! RUN_CONSTRUCTOR_TEST){ |
839 |
if (! RUN_CONSTRUCTOR_TEST){ |
776 |
printTestDisabledMessage("disabled for constructors for now"); |
840 |
printTestDisabledMessage("disabled for constructors for now"); |
Lines 859-873
Link Here
|
859 |
int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain |
923 |
int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain |
860 |
int[] deleted= null; |
924 |
int[] deleted= null; |
861 |
String newReturnTypeName= null; |
925 |
String newReturnTypeName= null; |
862 |
helperDoAll("Query.PoolMessageEvent", "PoolMessageEvent", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName); |
926 |
helperDoAll("Query.PoolMessageEvent", "PoolMessageEvent", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName, true, false, true); |
863 |
} |
927 |
} |
864 |
|
928 |
|
865 |
public void testRenameReorder26() throws Exception{ |
929 |
public void testRenameReorder26() throws Exception{ |
866 |
helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"zzz", "bb"}); |
930 |
helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"zzz", "bb"}, true, true); |
867 |
} |
931 |
} |
868 |
|
932 |
|
869 |
public void testRenameReorder27() throws Exception{ |
933 |
public void testRenameReorder27() throws Exception{ |
870 |
helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"yyy", "a"}); |
934 |
helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"a", "y"}, true, true); |
871 |
} |
935 |
} |
872 |
|
936 |
|
873 |
public void testAdd28()throws Exception{ |
937 |
public void testAdd28()throws Exception{ |
Lines 877-883
Link Here
|
877 |
String[] newDefaultValues= {"0"}; |
941 |
String[] newDefaultValues= {"0"}; |
878 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
942 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
879 |
int[] newIndices= {1}; |
943 |
int[] newIndices= {1}; |
880 |
helperAdd(signature, newParamInfo, newIndices); |
944 |
helperAdd(signature, newParamInfo, newIndices, true); |
881 |
} |
945 |
} |
882 |
|
946 |
|
883 |
public void testAdd29()throws Exception{ |
947 |
public void testAdd29()throws Exception{ |
Lines 887-893
Link Here
|
887 |
String[] newDefaultValues= {"0"}; |
951 |
String[] newDefaultValues= {"0"}; |
888 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
952 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
889 |
int[] newIndices= {0}; |
953 |
int[] newIndices= {0}; |
890 |
helperAdd(signature, newParamInfo, newIndices); |
954 |
helperAdd(signature, newParamInfo, newIndices, true); |
891 |
} |
955 |
} |
892 |
|
956 |
|
893 |
public void testAdd30()throws Exception{ |
957 |
public void testAdd30()throws Exception{ |
Lines 897-903
Link Here
|
897 |
String[] newDefaultValues= {"0"}; |
961 |
String[] newDefaultValues= {"0"}; |
898 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
962 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
899 |
int[] newIndices= {1}; |
963 |
int[] newIndices= {1}; |
900 |
helperAdd(signature, newParamInfo, newIndices); |
964 |
helperAdd(signature, newParamInfo, newIndices, true); |
901 |
} |
965 |
} |
902 |
|
966 |
|
903 |
public void testAdd31()throws Exception{ |
967 |
public void testAdd31()throws Exception{ |
Lines 907-913
Link Here
|
907 |
String[] newDefaultValues= {"0"}; |
971 |
String[] newDefaultValues= {"0"}; |
908 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
972 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
909 |
int[] newIndices= {1}; |
973 |
int[] newIndices= {1}; |
910 |
helperAdd(signature, newParamInfo, newIndices); |
974 |
helperAdd(signature, newParamInfo, newIndices, true); |
911 |
} |
975 |
} |
912 |
|
976 |
|
913 |
public void testAdd32()throws Exception{ |
977 |
public void testAdd32()throws Exception{ |
Lines 917-923
Link Here
|
917 |
String[] newDefaultValues= {"0"}; |
981 |
String[] newDefaultValues= {"0"}; |
918 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
982 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
919 |
int[] newIndices= {0}; |
983 |
int[] newIndices= {0}; |
920 |
helperAdd(signature, newParamInfo, newIndices); |
984 |
helperAdd(signature, newParamInfo, newIndices, true); |
921 |
} |
985 |
} |
922 |
|
986 |
|
923 |
public void testAdd33()throws Exception{ |
987 |
public void testAdd33()throws Exception{ |
Lines 927-933
Link Here
|
927 |
String[] newDefaultValues= {"0"}; |
991 |
String[] newDefaultValues= {"0"}; |
928 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
992 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
929 |
int[] newIndices= {0}; |
993 |
int[] newIndices= {0}; |
930 |
helperAdd(signature, newParamInfo, newIndices); |
994 |
helperAdd(signature, newParamInfo, newIndices, true); |
931 |
} |
995 |
} |
932 |
|
996 |
|
933 |
public void testAddReorderRename34()throws Exception{ |
997 |
public void testAddReorderRename34()throws Exception{ |
Lines 944-950
Link Here
|
944 |
int[] deletedIndices= null; |
1008 |
int[] deletedIndices= null; |
945 |
int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain |
1009 |
int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain |
946 |
String newReturnTypeName= null; |
1010 |
String newReturnTypeName= null; |
947 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1011 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
948 |
} |
1012 |
} |
949 |
|
1013 |
|
950 |
public void testAll35()throws Exception{ |
1014 |
public void testAll35()throws Exception{ |
Lines 1063-1069
Link Here
|
1063 |
int[] deletedIndices= {0}; |
1127 |
int[] deletedIndices= {0}; |
1064 |
int newVisibility= Modifier.NONE; |
1128 |
int newVisibility= Modifier.NONE; |
1065 |
String newReturnTypeName= null; |
1129 |
String newReturnTypeName= null; |
1066 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1130 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1067 |
} |
1131 |
} |
1068 |
|
1132 |
|
1069 |
public void testAll42()throws Exception{ |
1133 |
public void testAll42()throws Exception{ |
Lines 1097-1103
Link Here
|
1097 |
int[] deletedIndices= {0}; |
1161 |
int[] deletedIndices= {0}; |
1098 |
int newVisibility= Modifier.NONE; |
1162 |
int newVisibility= Modifier.NONE; |
1099 |
String newReturnTypeName= null; |
1163 |
String newReturnTypeName= null; |
1100 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1164 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1101 |
} |
1165 |
} |
1102 |
|
1166 |
|
1103 |
public void testAll44()throws Exception{ |
1167 |
public void testAll44()throws Exception{ |
Lines 1149-1155
Link Here
|
1149 |
printTestDisabledMessage("disabled for constructors for now"); |
1213 |
printTestDisabledMessage("disabled for constructors for now"); |
1150 |
return; |
1214 |
return; |
1151 |
} |
1215 |
} |
1152 |
|
1216 |
|
1153 |
String[] signature= {}; |
1217 |
String[] signature= {}; |
1154 |
String[] newNames= {"i"}; |
1218 |
String[] newNames= {"i"}; |
1155 |
String[] newTypes= {"int"}; |
1219 |
String[] newTypes= {"int"}; |
Lines 1166-1171
Link Here
|
1166 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1230 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1167 |
} |
1231 |
} |
1168 |
|
1232 |
|
|
|
1233 |
public void testAll46b()throws Exception{ |
1234 |
if (! RUN_CONSTRUCTOR_TEST){ |
1235 |
printTestDisabledMessage("disabled for constructors for now"); |
1236 |
return; |
1237 |
} |
1238 |
|
1239 |
String[] signature= {}; |
1240 |
String[] newNames= {"i"}; |
1241 |
String[] newTypes= {"int"}; |
1242 |
String[] newDefaultValues= {"1"}; |
1243 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
1244 |
int[] newIndices= {0}; |
1245 |
|
1246 |
String[] oldParamNames= {}; |
1247 |
String[] newParamNames= {}; |
1248 |
int[] permutation= {0}; |
1249 |
int[] deletedIndices= null; |
1250 |
int newVisibility= Modifier.NONE; |
1251 |
String newReturnTypeName= null; |
1252 |
helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, false); |
1253 |
} |
1254 |
|
1169 |
public void testAll47()throws Exception{ |
1255 |
public void testAll47()throws Exception{ |
1170 |
if (! RUN_CONSTRUCTOR_TEST){ |
1256 |
if (! RUN_CONSTRUCTOR_TEST){ |
1171 |
printTestDisabledMessage("disabled for constructors for now"); |
1257 |
printTestDisabledMessage("disabled for constructors for now"); |
Lines 1465-1471
Link Here
|
1465 |
String[] newDefaultValues= {"true"}; |
1551 |
String[] newDefaultValues= {"true"}; |
1466 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
1552 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
1467 |
int[] newIndices= {1}; |
1553 |
int[] newIndices= {1}; |
1468 |
helperAdd(signature, newParamInfo, newIndices); |
1554 |
helperAdd(signature, newParamInfo, newIndices, true, true); |
|
|
1555 |
} |
1556 |
|
1557 |
public void testAddRecursive2()throws Exception{ |
1558 |
// As above, but don't update callers |
1559 |
String[] signature= {"I"}; |
1560 |
String[] newNames= {"bool"}; |
1561 |
String[] newTypes= {"boolean"}; |
1562 |
String[] newDefaultValues= {"true"}; |
1563 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
1564 |
int[] newIndices= {1}; |
1565 |
helperAdd(signature, newParamInfo, newIndices, true, false); |
1469 |
} |
1566 |
} |
1470 |
|
1567 |
|
1471 |
public void testException01() throws Exception { |
1568 |
public void testException01() throws Exception { |
Lines 1525-1536
Link Here
|
1525 |
|
1622 |
|
1526 |
public void testName01() throws Exception { |
1623 |
public void testName01() throws Exception { |
1527 |
String[] signature= {"QString;"}; |
1624 |
String[] signature= {"QString;"}; |
1528 |
helperRenameMethod(signature, "newName"); |
1625 |
helperRenameMethod(signature, "newName",true); |
1529 |
} |
1626 |
} |
1530 |
|
1627 |
|
1531 |
public void testName02() throws Exception { |
1628 |
public void testName02() throws Exception { |
1532 |
String[] signature= {"QString;"}; |
1629 |
String[] signature= {"QString;"}; |
1533 |
helperRenameMethod(signature, "newName"); |
1630 |
helperRenameMethod(signature, "newName",true); |
1534 |
} |
1631 |
} |
1535 |
|
1632 |
|
1536 |
public void testFailImport01() throws Exception { |
1633 |
public void testFailImport01() throws Exception { |
Lines 1738-1744
Link Here
|
1738 |
printTestDisabledMessage("BUG_83319_CORE_REFS_IN_STATIC_IMPORT"); |
1835 |
printTestDisabledMessage("BUG_83319_CORE_REFS_IN_STATIC_IMPORT"); |
1739 |
return; |
1836 |
return; |
1740 |
} |
1837 |
} |
1741 |
helperRenameMethod(new String[0], "abc"); |
1838 |
helperRenameMethod(new String[0], "abc", false); |
1742 |
} |
1839 |
} |
1743 |
|
1840 |
|
1744 |
public void testStaticImport02() throws Exception { |
1841 |
public void testStaticImport02() throws Exception { |
Lines 1782-1788
Link Here
|
1782 |
int[] deletedIndices= {}; |
1879 |
int[] deletedIndices= {}; |
1783 |
int newVisibility= Modifier.PUBLIC; |
1880 |
int newVisibility= Modifier.PUBLIC; |
1784 |
String newReturnTypeName= null; |
1881 |
String newReturnTypeName= null; |
1785 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1882 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1786 |
} |
1883 |
} |
1787 |
|
1884 |
|
1788 |
public void testVararg03() throws Exception { |
1885 |
public void testVararg03() throws Exception { |
Lines 1823-1828
Link Here
|
1823 |
String newReturnTypeName= null; |
1920 |
String newReturnTypeName= null; |
1824 |
helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1921 |
helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1825 |
} |
1922 |
} |
|
|
1923 |
|
1924 |
public void testVararg04b() throws Exception { |
1925 |
String[] signature= {"[QString;"}; |
1926 |
String[] newNames= {"i"}; |
1927 |
String[] newTypes= {"int"}; |
1928 |
String[] newDefaultValues= {"1"}; |
1929 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
1930 |
int[] newIndices= {0}; |
1931 |
|
1932 |
String[] oldParamNames= {"args"}; |
1933 |
String[] newParamNames= {"args"}; |
1934 |
int[] permutation= {}; |
1935 |
int[] deletedIndices= {}; |
1936 |
int newVisibility= Modifier.PUBLIC; |
1937 |
String newReturnTypeName= null; |
1938 |
helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, true, false); |
1939 |
} |
1826 |
|
1940 |
|
1827 |
public void testVararg05() throws Exception { |
1941 |
public void testVararg05() throws Exception { |
1828 |
String[] signature= {"QObject;", "[QString;"}; |
1942 |
String[] signature= {"QObject;", "[QString;"}; |
Lines 1838-1844
Link Here
|
1838 |
int[] deletedIndices= {1}; |
1952 |
int[] deletedIndices= {1}; |
1839 |
int newVisibility= Modifier.PUBLIC; |
1953 |
int newVisibility= Modifier.PUBLIC; |
1840 |
String newReturnTypeName= null; |
1954 |
String newReturnTypeName= null; |
1841 |
helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1955 |
helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1842 |
} |
1956 |
} |
1843 |
|
1957 |
|
1844 |
public void testVararg06() throws Exception { |
1958 |
public void testVararg06() throws Exception { |
Lines 1874-1880
Link Here
|
1874 |
int[] deletedIndices= { 1 }; |
1988 |
int[] deletedIndices= { 1 }; |
1875 |
int newVisibility= Modifier.PUBLIC; |
1989 |
int newVisibility= Modifier.PUBLIC; |
1876 |
String newReturnTypeName= null; |
1990 |
String newReturnTypeName= null; |
1877 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName); |
1991 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1878 |
} |
1992 |
} |
1879 |
|
1993 |
|
1880 |
public void testVararg08() throws Exception { |
1994 |
public void testVararg08() throws Exception { |
Lines 1972-1978
Link Here
|
1972 |
int[] deletedIndices= { }; |
2086 |
int[] deletedIndices= { }; |
1973 |
int newVisibility= Modifier.NONE; |
2087 |
int newVisibility= Modifier.NONE; |
1974 |
String newReturnTypeName= null; |
2088 |
String newReturnTypeName= null; |
1975 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName); |
2089 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
1976 |
} |
2090 |
} |
1977 |
|
2091 |
|
1978 |
public void testGenerics03() throws Exception { |
2092 |
public void testGenerics03() throws Exception { |
Lines 2011-2015
Link Here
|
2011 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName); |
2125 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName); |
2012 |
} |
2126 |
} |
2013 |
|
2127 |
|
2014 |
} |
2128 |
public void testGenerics05() throws Exception { |
|
|
2129 |
if (true){ |
2130 |
printTestDisabledMessage("how to add old bindings?"); |
2131 |
return; |
2132 |
} |
2133 |
String[] signature= {"QT;", "QE;"}; |
2134 |
String[] newNames= {"maps"}; |
2135 |
String[] newTypes= {"java.util.List<HashMap>"}; |
2136 |
String[] newDefaultValues= {"null"}; |
2137 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
2138 |
int[] newIndices= {2}; |
2139 |
|
2140 |
String[] oldParamNames= {"e", "t"}; |
2141 |
String[] newParamNames= {"e", "t"}; |
2142 |
String[] newParameterTypeNames= null; |
2143 |
int[] permutation= {1, 0, 2}; |
2144 |
int[] deletedIndices= { }; |
2145 |
int newVisibility= Modifier.NONE; |
2146 |
String newReturnTypeName= null; |
2147 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
2148 |
} |
2015 |
|
2149 |
|
|
|
2150 |
public void testGenerics06() throws Exception { |
2151 |
if (true){ |
2152 |
printTestDisabledMessage("how to add old bindings?"); |
2153 |
return; |
2154 |
} |
2155 |
String[] signature= {"QList<QInteger;>;", "QA<QString;>;"}; |
2156 |
String[] newNames= {"li"}; |
2157 |
String[] newTypes= {"List<Integer>"}; |
2158 |
String[] newDefaultValues= {"null"}; |
2159 |
ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); |
2160 |
int[] newIndices= {2}; |
2161 |
|
2162 |
String[] oldParamNames= {"li", "as"}; |
2163 |
String[] newParamNames= {"li", "as"}; |
2164 |
String[] newParameterTypeNames= null; |
2165 |
int[] permutation= {1, 2, 0}; |
2166 |
int[] deletedIndices= {0}; |
2167 |
int newVisibility= Modifier.PUBLIC; |
2168 |
String newReturnTypeName= null; |
2169 |
helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true); |
2170 |
} |
2171 |
} |