View | Details | Raw Unified | Return to bug 144504
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java (-3 / +11 lines)
Lines 230-242 Link Here
230
 * @return a list ({@link List}) of tests ({@link Test}).
230
 * @return a list ({@link List}) of tests ({@link Test}).
231
 */
231
 */
232
public static List buildTestsList(Class evaluationTestClass) {
232
public static List buildTestsList(Class evaluationTestClass) {
233
	return buildTestsList(evaluationTestClass, 0);
233
	return buildTestsList(evaluationTestClass, 0/*only one level*/, 0/* do not sort*/);
234
}
234
}
235
235
236
/**
236
/**
237
 * Build a list of method to run for a test suite.
237
 * Build a list of methods to run for a test suite.
238
 * This methods list may be sorted in alphabetical order if specified.
239
 * <br>
238
 * Differ from {@link #buildTestsList(Class)} in the fact that one
240
 * Differ from {@link #buildTestsList(Class)} in the fact that one
239
 * can specify level of recursion in hierarchy to find additional tests.
241
 * can specify level of recursion in hierarchy to find additional tests.
242
 * <br>
240
 * For example
243
 * For example
241
 * <pre>
244
 * <pre>
242
 * 	public class AbstractTest extends TestCase {
245
 * 	public class AbstractTest extends TestCase {
Lines 275-281 Link Here
275
 * @param inheritedDepth level of recursion in top-level hierarchy to find other tests
278
 * @param inheritedDepth level of recursion in top-level hierarchy to find other tests
276
 * @return a {@link List} a {@link Test}
279
 * @return a {@link List} a {@link Test}
277
 */
280
 */
278
public static List buildTestsList(Class evaluationTestClass, int inheritedDepth) {
281
public static List buildTestsList(Class evaluationTestClass, int inheritedDepth, int sort) {
279
	List tests = new ArrayList();
282
	List tests = new ArrayList();
280
	List testNames = new ArrayList();
283
	List testNames = new ArrayList();
281
	List onlyNames = new ArrayList();
284
	List onlyNames = new ArrayList();
Lines 387-392 Link Here
387
390
388
	// Add corresponding tests
391
	// Add corresponding tests
389
	List names = onlyNames.size() > 0 ? onlyNames : testNames;
392
	List names = onlyNames.size() > 0 ? onlyNames : testNames;
393
	if (sort>0) {
394
		Collections.sort(names);
395
	} else if (sort<0) {
396
		// TODO (frederic) implement execution in reverse order
397
	}
390
	Iterator iterator = names.iterator();
398
	Iterator iterator = names.iterator();
391
	while (iterator.hasNext()) {
399
	while (iterator.hasNext()) {
392
		String testName = (String) iterator.next();
400
		String testName = (String) iterator.next();
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericMethodExactTests.java (-1 / +1 lines)
Lines 31-37 Link Here
31
31
32
	public static Test suite() {
32
	public static Test suite() {
33
		TestSuite suite = new Suite(JavaSearchGenericMethodExactTests.class.getName());
33
		TestSuite suite = new Suite(JavaSearchGenericMethodExactTests.class.getName());
34
		List tests = buildTestsList(JavaSearchGenericMethodExactTests.class, 1);
34
		List tests = buildTestsList(JavaSearchGenericMethodExactTests.class, 1, 0/* do not sort*/);
35
		for (int index=0, size=tests.size(); index<size; index++) {
35
		for (int index=0, size=tests.size(); index<size; index++) {
36
			suite.addTest((Test)tests.get(index));
36
			suite.addTest((Test)tests.get(index));
37
		}
37
		}
(-)src/org/eclipse/jdt/core/tests/model/JavadocFieldCompletionModelTest.java (-7 / +8 lines)
Lines 35-45 Link Here
35
	return buildModelTestSuite(JavadocFieldCompletionModelTest.class);
35
	return buildModelTestSuite(JavadocFieldCompletionModelTest.class);
36
}
36
}
37
37
38
/* (non-Javadoc)
39
 * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelCompletionTests#setUp()
40
 */
41
protected void setUp() throws Exception {
42
	super.setUp();
43
	setUpProjectOptions(CompilerOptions.VERSION_1_4); // default compliance
44
}
45
38
/**
46
/**
39
 * @category Tests for tag names completion
47
 * @category Tests for tag names completion
40
 */
48
 */
41
public void test001() throws JavaModelException {
49
public void test001() throws JavaModelException {
42
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
43
	String source =
50
	String source =
44
		"package javadoc.fields;\n" +
51
		"package javadoc.fields;\n" +
45
		"public class Test {\n" +
52
		"public class Test {\n" +
Lines 183-189 Link Here
183
 * @category Tests for types completion
190
 * @category Tests for types completion
184
 */
191
 */
185
public void test010() throws JavaModelException {
192
public void test010() throws JavaModelException {
186
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
187
	String source =
193
	String source =
188
		"package javadoc.fields.tags;\n" + 
194
		"package javadoc.fields.tags;\n" + 
189
		"public class BasicTestFields {\n" + 
195
		"public class BasicTestFields {\n" + 
Lines 200-206 Link Here
200
}
206
}
201
207
202
public void test011() throws JavaModelException {
208
public void test011() throws JavaModelException {
203
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
204
	String source =
209
	String source =
205
		"package javadoc.fields.tags;\n" + 
210
		"package javadoc.fields.tags;\n" + 
206
		"public class BasicTestFields {\n" + 
211
		"public class BasicTestFields {\n" + 
Lines 218-224 Link Here
218
}
223
}
219
224
220
public void test012() throws JavaModelException {
225
public void test012() throws JavaModelException {
221
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
222
	String source =
226
	String source =
223
		"package javadoc.fields.tags;\n" + 
227
		"package javadoc.fields.tags;\n" + 
224
		"public class BasicTestFields {\n" + 
228
		"public class BasicTestFields {\n" + 
Lines 236-242 Link Here
236
}
240
}
237
241
238
public void test013() throws JavaModelException {
242
public void test013() throws JavaModelException {
239
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
240
	String source =
243
	String source =
241
		"package javadoc.fields.tags;\n" + 
244
		"package javadoc.fields.tags;\n" + 
242
		"public class BasicTestFields {\n" + 
245
		"public class BasicTestFields {\n" + 
Lines 254-260 Link Here
254
}
257
}
255
258
256
public void test014() throws JavaModelException {
259
public void test014() throws JavaModelException {
257
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
258
	String source =
260
	String source =
259
		"package javadoc.fields.tags;\n" + 
261
		"package javadoc.fields.tags;\n" + 
260
		"public class BasicTestFields {\n" + 
262
		"public class BasicTestFields {\n" + 
Lines 273-279 Link Here
273
}
275
}
274
276
275
public void test015() throws JavaModelException {
277
public void test015() throws JavaModelException {
276
	setUpProjectOptions(CompilerOptions.VERSION_1_4);
277
	String source =
278
	String source =
278
		"package javadoc.fields.tags;\n" + 
279
		"package javadoc.fields.tags;\n" + 
279
		"public class BasicTestFields {\n" + 
280
		"public class BasicTestFields {\n" + 
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericMethodEquivalentTests.java (-1 / +1 lines)
Lines 32-38 Link Here
32
32
33
	public static Test suite() {
33
	public static Test suite() {
34
		TestSuite suite = new Suite(JavaSearchGenericMethodEquivalentTests.class.getName());
34
		TestSuite suite = new Suite(JavaSearchGenericMethodEquivalentTests.class.getName());
35
		List tests = buildTestsList(JavaSearchGenericMethodEquivalentTests.class, 1);
35
		List tests = buildTestsList(JavaSearchGenericMethodEquivalentTests.class, 1, 0/* do not sort*/);
36
		for (int index=0, size=tests.size(); index<size; index++) {
36
		for (int index=0, size=tests.size(); index<size; index++) {
37
			suite.addTest((Test)tests.get(index));
37
			suite.addTest((Test)tests.get(index));
38
		}
38
		}
(-)src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java (-1 / +1 lines)
Lines 35-41 Link Here
35
//		TESTS_RANGE = new int[] { 21, 38 };
35
//		TESTS_RANGE = new int[] { 21, 38 };
36
	}
36
	}
37
	public static Test suite() {
37
	public static Test suite() {
38
		return buildModelTestSuite(CreateMembersTests.class);
38
		return buildModelTestSuite(CreateMembersTests.class, 1/*sort ascending order*/);
39
	}
39
	}
40
	public void setUpSuite() throws Exception {
40
	public void setUpSuite() throws Exception {
41
		super.setUpSuite();
41
		super.setUpSuite();
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-504 / +430 lines)
Lines 582-588 Link Here
582
 * Bug 77093: [search] No references found to method with member type argument
582
 * Bug 77093: [search] No references found to method with member type argument
583
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=77093"
583
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=77093"
584
 */
584
 */
585
public void testBug77093constructor() throws CoreException {
585
private void setUpBug77093() throws CoreException {
586
	workingCopies = new ICompilationUnit[1];
586
	workingCopies = new ICompilationUnit[1];
587
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b77093/X.java",
587
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b77093/X.java",
588
		"package b77093;\n" + 
588
		"package b77093;\n" + 
Lines 602-626 Link Here
602
		"		for (int i=0; i<z_arrays.length; i++)\n" + 
602
		"		for (int i=0; i<z_arrays.length; i++)\n" + 
603
		"			foo(z_arrays[i]);\n" + 
603
		"			foo(z_arrays[i]);\n" + 
604
		"	}\n" + 
604
		"	}\n" + 
605
		"}");
605
		"}"
606
	);
607
}
608
public void testBug77093constructor() throws CoreException {
609
	setUpBug77093();
606
	IType type = workingCopies[0].getType("X");
610
	IType type = workingCopies[0].getType("X");
607
	IMethod method = type.getMethod("X", new String[] {"[[QZ;"});
611
	IMethod method = type.getMethod("X", new String[] {"[[QZ;"});
608
	// Search for constructor declarations and references
612
	// Search for constructor declarations and references
609
	search(method, ALL_OCCURRENCES);
613
	search(method, ALL_OCCURRENCES);
610
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
611
	assertSearchResults(
614
	assertSearchResults(
612
		"src/b77093/X.java b77093.X() [this(new Z[10][])] EXACT_MATCH\n"+
615
		"src/b77093/X.java b77093.X() [this(new Z[10][])] EXACT_MATCH\n"+
613
		"src/b77093/X.java b77093.X(Z[][]) [X] EXACT_MATCH"
616
		"src/b77093/X.java b77093.X(Z[][]) [X] EXACT_MATCH"
614
	);
617
	);
615
}
618
}
616
public void testBug77093field() throws CoreException {
619
public void testBug77093field() throws CoreException {
617
	assertNotNull("There should be working copies!", workingCopies);
620
	setUpBug77093();
618
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
619
	IType type = workingCopies[0].getType("X");
621
	IType type = workingCopies[0].getType("X");
620
	IField field = type.getField("z_arrays");
622
	IField field = type.getField("z_arrays");
621
	// Search for field declarations and references
623
	// Search for field declarations and references
622
	search(field, ALL_OCCURRENCES);
624
	search(field, ALL_OCCURRENCES);
623
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
624
	assertSearchResults(
625
	assertSearchResults(
625
		"src/b77093/X.java b77093.X.z_arrays [z_arrays] EXACT_MATCH\n" +
626
		"src/b77093/X.java b77093.X.z_arrays [z_arrays] EXACT_MATCH\n" +
626
		"src/b77093/X.java b77093.X(Z[][]) [z_arrays] EXACT_MATCH\n" + 
627
		"src/b77093/X.java b77093.X(Z[][]) [z_arrays] EXACT_MATCH\n" + 
Lines 629-636 Link Here
629
	);
630
	);
630
}
631
}
631
public void testBug77093method() throws CoreException {
632
public void testBug77093method() throws CoreException {
632
	assertNotNull("There should be working copies!", workingCopies);
633
	setUpBug77093();
633
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
634
	IType type = workingCopies[0].getType("X");
634
	IType type = workingCopies[0].getType("X");
635
	IMethod method = type.getMethod("foo", new String[] {"[QZ;"});
635
	IMethod method = type.getMethod("foo", new String[] {"[QZ;"});
636
	search(method, ALL_OCCURRENCES);
636
	search(method, ALL_OCCURRENCES);
Lines 662-667 Link Here
662
		"src/b77388/Test.java void b77388.Test.run() [new Test(1, 2)] EXACT_MATCH"
662
		"src/b77388/Test.java void b77388.Test.run() [new Test(1, 2)] EXACT_MATCH"
663
	);
663
	);
664
}
664
}
665
665
/**
666
/**
666
 * Bug 78082: [1.5][search] FieldReferenceMatch in static import should not include qualifier
667
 * Bug 78082: [1.5][search] FieldReferenceMatch in static import should not include qualifier
667
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=78082"
668
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=78082"
Lines 762-776 Link Here
762
	IMethod[] methods = workingCopies[0].getType("Test").getMethods();
763
	IMethod[] methods = workingCopies[0].getType("Test").getMethods();
763
	assertEquals("Invalid number of methods", 3, methods.length);
764
	assertEquals("Invalid number of methods", 3, methods.length);
764
	search(methods[0], REFERENCES);
765
	search(methods[0], REFERENCES);
765
	discard = false; // use working copy for next test
766
	assertSearchResults(
766
	assertSearchResults(
767
		"src/b79378/A.java void b79378.Test.call() [foo79378(s, exceptions)] POTENTIAL_MATCH"
767
		"src/b79378/A.java void b79378.Test.call() [foo79378(s, exceptions)] POTENTIAL_MATCH"
768
	);
768
	);
769
}
769
}
770
public void testBug79378b() throws CoreException {
770
public void testBug79378b() throws CoreException {
771
	resultCollector.showRule = true;
771
	resultCollector.showRule = true;
772
	assertNotNull("There should be working copies!", workingCopies);
772
	workingCopies = new ICompilationUnit[1];
773
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
773
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b79378/A.java",
774
		"package b79378;\n" + 
775
		"public class Test {\n" + 
776
		"	void foo79378(String s, RuntimeException[] exceptions) {}\n" + 
777
		"	void foo79378(RuntimeException[] exceptions) {}\n" + 
778
		"	void call() {\n" + 
779
		"		String s= null; \n" + 
780
		"		Exception[] exceptions= null;\n" + 
781
		"		foo79378(s, exceptions);\n" + 
782
		"	}\n" + 
783
		"}\n"
784
	);
774
	IMethod[] methods = workingCopies[0].getType("Test").getMethods();
785
	IMethod[] methods = workingCopies[0].getType("Test").getMethods();
775
	assertEquals("Invalid number of methods", 3, methods.length);
786
	assertEquals("Invalid number of methods", 3, methods.length);
776
	search(methods[1], REFERENCES);
787
	search(methods[1], REFERENCES);
Lines 788-805 Link Here
788
		"class A<A> {\n" + 
799
		"class A<A> {\n" + 
789
		"    A a;\n" + 
800
		"    A a;\n" + 
790
		"    b79803.A pa= new b79803.A();\n" + 
801
		"    b79803.A pa= new b79803.A();\n" + 
791
		"}\n"	);
802
		"}\n"	
803
	);
792
	IType type = workingCopies[0].getType("A");
804
	IType type = workingCopies[0].getType("A");
793
	search(type, REFERENCES, ERASURE_RULE);
805
	search(type, REFERENCES, ERASURE_RULE);
794
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
795
	assertSearchResults(
806
	assertSearchResults(
796
		"src/b79803/A.java b79803.A.pa [b79803.A] EXACT_MATCH\n" + 
807
		"src/b79803/A.java b79803.A.pa [b79803.A] EXACT_MATCH\n" + 
797
		"src/b79803/A.java b79803.A.pa [b79803.A] EXACT_MATCH"
808
		"src/b79803/A.java b79803.A.pa [b79803.A] EXACT_MATCH"
798
	);
809
	);
799
}
810
}
800
public void testBug79803string() throws CoreException {
811
public void testBug79803string() throws CoreException {
801
	assertNotNull("There should be working copies!", workingCopies);
812
	workingCopies = new ICompilationUnit[1];
802
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
813
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b79803/A.java",
814
		"package b79803;\n" + 
815
		"class A<A> {\n" + 
816
		"    A a;\n" + 
817
		"    b79803.A pa= new b79803.A();\n" + 
818
		"}\n"	
819
	);
803
	search("A", TYPE, REFERENCES);
820
	search("A", TYPE, REFERENCES);
804
	assertSearchResults(
821
	assertSearchResults(
805
		"src/b79803/A.java b79803.A.a [A] EXACT_MATCH\n" + 
822
		"src/b79803/A.java b79803.A.a [A] EXACT_MATCH\n" + 
Lines 832-845 Link Here
832
		true);
849
		true);
833
	IType type = workingCopies[0].getType("A");
850
	IType type = workingCopies[0].getType("A");
834
	search(type, REFERENCES);
851
	search(type, REFERENCES);
835
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
836
	assertSearchResults(
852
	assertSearchResults(
837
		"src/b79860/X.java b79860.X [A] EXACT_MATCH"
853
		"src/b79860/X.java b79860.X [A] EXACT_MATCH"
838
	);
854
	);
839
}
855
}
840
public void testBug79860string() throws CoreException {
856
public void testBug79860string() throws CoreException {
841
	assertNotNull("There should be working copies!", workingCopies);
857
	workingCopies = new ICompilationUnit[2];
842
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
858
	WorkingCopyOwner owner = new WorkingCopyOwner() {};
859
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b79860/X.java",
860
		"package b79860;\n" + 
861
		"public class X<T extends A> { }\n" + 
862
		"class A { }",
863
		owner,
864
		true);
865
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b79860/Y.java",
866
		"package b79860;\n" + 
867
		"public class Y<T extends B&I1&I2&I3> { }\n" + 
868
		"class B { }\n" + 
869
		"interface I1 {}\n" + 
870
		"interface I2 {}\n" + 
871
		"interface I3 {}\n",
872
		owner,
873
		true);
843
	search("I?", TYPE, REFERENCES);
874
	search("I?", TYPE, REFERENCES);
844
	assertSearchResults(
875
	assertSearchResults(
845
		"src/b79860/Y.java b79860.Y [I1] EXACT_MATCH\n" + 
876
		"src/b79860/Y.java b79860.Y [I1] EXACT_MATCH\n" + 
Lines 852-858 Link Here
852
 * Bug 79990: [1.5][search] Search doesn't find type reference in type parameter bound
883
 * Bug 79990: [1.5][search] Search doesn't find type reference in type parameter bound
853
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=79990"
884
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=79990"
854
 */
885
 */
855
public void testBug79990() throws CoreException {
886
private void setUpBug79990() throws CoreException {
856
	workingCopies = new ICompilationUnit[1];
887
	workingCopies = new ICompilationUnit[1];
857
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b79990/Test.java",
888
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b79990/Test.java",
858
		"package b79990;\n" + 
889
		"package b79990;\n" + 
Lines 864-892 Link Here
864
		"    public void first(Exception num) {}\n" + 
895
		"    public void first(Exception num) {}\n" + 
865
		"    public void second(Exception t) {}\n" + 
896
		"    public void second(Exception t) {}\n" + 
866
		"}\n"
897
		"}\n"
867
	);
898
	);}
899
public void testBug79990() throws CoreException {
900
	setUpBug79990();
868
	IMethod method = workingCopies[0].getType("Test").getMethods()[0];
901
	IMethod method = workingCopies[0].getType("Test").getMethods()[0];
869
	search(method, DECLARATIONS);
902
	search(method, DECLARATIONS);
870
	this.discard = false;
871
	assertSearchResults(
903
	assertSearchResults(
872
		"src/b79990/Test.java void b79990.Test.first(Exception) [first] EXACT_MATCH\n" + 
904
		"src/b79990/Test.java void b79990.Test.first(Exception) [first] EXACT_MATCH\n" + 
873
		"src/b79990/Test.java void b79990.Sub.first(Exception) [first] EXACT_MATCH"
905
		"src/b79990/Test.java void b79990.Sub.first(Exception) [first] EXACT_MATCH"
874
	);
906
	);
875
}
907
}
876
public void testBug79990b() throws CoreException {
908
public void testBug79990b() throws CoreException {
877
	assertNotNull("There should be working copies!", workingCopies);
909
	setUpBug79990();
878
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
879
	IMethod method = workingCopies[0].getType("Test").getMethods()[1];
910
	IMethod method = workingCopies[0].getType("Test").getMethods()[1];
880
	search(method, DECLARATIONS);
911
	search(method, DECLARATIONS);
881
	this.discard = false;
882
	assertSearchResults(
912
	assertSearchResults(
883
		"src/b79990/Test.java void b79990.Test.second(T) [second] EXACT_MATCH\n" + 
913
		"src/b79990/Test.java void b79990.Test.second(T) [second] EXACT_MATCH\n" + 
884
		"src/b79990/Test.java void b79990.Sub.second(Exception) [second] EXACT_MATCH"
914
		"src/b79990/Test.java void b79990.Sub.second(Exception) [second] EXACT_MATCH"
885
	);
915
	);
886
}
916
}
887
public void testBug79990c() throws CoreException {
917
public void testBug79990c() throws CoreException {
888
	assertNotNull("There should be working copies!", workingCopies);
918
	setUpBug79990();
889
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
890
	IMethod method = workingCopies[0].getType("Test").getMethods()[1];
919
	IMethod method = workingCopies[0].getType("Test").getMethods()[1];
891
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
920
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
892
	assertSearchResults(
921
	assertSearchResults(
Lines 942-948 Link Here
942
 * Bug 80194: [1.5][search]Rename field fails on field based on parameterized type with member type parameter
971
 * Bug 80194: [1.5][search]Rename field fails on field based on parameterized type with member type parameter
943
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80194"
972
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80194"
944
 */
973
 */
945
public void testBug80194() throws CoreException, JavaModelException {
974
private void setUpBug80194() throws CoreException, JavaModelException {
946
	workingCopies = new ICompilationUnit[1];
975
	workingCopies = new ICompilationUnit[1];
947
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80194/Test.java",
976
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80194/Test.java",
948
		"package b80194;\n" + 
977
		"package b80194;\n" + 
Lines 960-989 Link Here
960
		"	void doSomething(final boolean flag) {}\n" + 
989
		"	void doSomething(final boolean flag) {}\n" + 
961
		"}\n"
990
		"}\n"
962
	);
991
	);
992
}
993
public void testBug80194() throws CoreException, JavaModelException {
994
	setUpBug80194();
963
	IType type = workingCopies[0].getType("Test");
995
	IType type = workingCopies[0].getType("Test");
964
	IMethod method = type.getMethod("doSomething", new String[] { "QMap<QString;QObject;>;" } );
996
	IMethod method = type.getMethod("doSomething", new String[] { "QMap<QString;QObject;>;" } );
965
	search(method, REFERENCES);
997
	search(method, REFERENCES);
966
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
967
	assertSearchResults(
998
	assertSearchResults(
968
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH"
999
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH"
969
	);
1000
	);
970
}
1001
}
971
public void testBug80194b() throws CoreException, JavaModelException {
1002
public void testBug80194b() throws CoreException, JavaModelException {
972
	assertNotNull("There should be working copies!", workingCopies);
1003
	setUpBug80194();
973
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
974
	IType type = workingCopies[0].getType("Test");
1004
	IType type = workingCopies[0].getType("Test");
975
	IMethod method = type.getMethod("doSomething", new String[] { "QMap<QString;QObject;>;", "Z" } );
1005
	IMethod method = type.getMethod("doSomething", new String[] { "QMap<QString;QObject;>;", "Z" } );
976
	search(method, REFERENCES);
1006
	search(method, REFERENCES);
977
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
978
	assertSearchResults(
1007
	assertSearchResults(
979
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map, true)] EXACT_MATCH"
1008
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map, true)] EXACT_MATCH"
980
	);
1009
	);
981
}
1010
}
982
public void testBug80194string1() throws CoreException, JavaModelException {
1011
public void testBug80194string1() throws CoreException, JavaModelException {
983
	assertNotNull("There should be working copies!", workingCopies);
1012
	setUpBug80194();
984
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
985
	search("doSomething(boolean)", METHOD, ALL_OCCURRENCES);
1013
	search("doSomething(boolean)", METHOD, ALL_OCCURRENCES);
986
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
987
	assertSearchResults(
1014
	assertSearchResults(
988
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH\n" + 
1015
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH\n" + 
989
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(true)] EXACT_MATCH\n" + 
1016
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(true)] EXACT_MATCH\n" + 
Lines 991-1000 Link Here
991
	);
1018
	);
992
}
1019
}
993
public void testBug80194string2() throws CoreException, JavaModelException {
1020
public void testBug80194string2() throws CoreException, JavaModelException {
994
	assertNotNull("There should be working copies!", workingCopies);
1021
	setUpBug80194();
995
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
996
	search("doSomething(Map<String,Object>)", METHOD, ALL_OCCURRENCES);
1022
	search("doSomething(Map<String,Object>)", METHOD, ALL_OCCURRENCES);
997
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
998
	assertSearchResults(
1023
	assertSearchResults(
999
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH\n" + 
1024
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map)] EXACT_MATCH\n" + 
1000
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(true)] EXACT_MATCH\n" + 
1025
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(true)] EXACT_MATCH\n" + 
Lines 1002-1009 Link Here
1002
	);
1027
	);
1003
}
1028
}
1004
public void testBug80194string3() throws CoreException, JavaModelException {
1029
public void testBug80194string3() throws CoreException, JavaModelException {
1005
	assertNotNull("There should be working copies!", workingCopies);
1030
	setUpBug80194();
1006
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1007
	search("doSomething(Map<String,Object>,boolean)", METHOD, ALL_OCCURRENCES);
1031
	search("doSomething(Map<String,Object>,boolean)", METHOD, ALL_OCCURRENCES);
1008
	assertSearchResults(
1032
	assertSearchResults(
1009
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map, true)] EXACT_MATCH\n" + 
1033
		"src/b80194/Test.java void b80194.Test.callDoSomething() [doSomething(map, true)] EXACT_MATCH\n" + 
Lines 1050-1056 Link Here
1050
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=87778"
1074
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=87778"
1051
 */
1075
 */
1052
// Methods
1076
// Methods
1053
public void testBug80264_Methods() throws CoreException {
1077
private void setUpBug80264_Methods() throws CoreException {
1054
	workingCopies = new ICompilationUnit[1];
1078
	workingCopies = new ICompilationUnit[1];
1055
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Methods.java",
1079
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Methods.java",
1056
		"package b80264;\n" + 
1080
		"package b80264;\n" + 
Lines 1067-1077 Link Here
1067
		"    Methods covariant() { return null; }\n" + 
1091
		"    Methods covariant() { return null; }\n" + 
1068
		"}\n"
1092
		"}\n"
1069
	);
1093
	);
1094
}
1095
public void testBug80264_Methods() throws CoreException {
1096
	setUpBug80264_Methods();
1070
	IType type = workingCopies[0].getType("Methods");
1097
	IType type = workingCopies[0].getType("Methods");
1071
	IMethod[] methods = type.getMethods();
1098
	IMethod[] methods = type.getMethods();
1072
	search(methods[0], DECLARATIONS);
1099
	search(methods[0], DECLARATIONS);
1073
	search(methods[1], DECLARATIONS);
1100
	search(methods[1], DECLARATIONS);
1074
	this.discard = false;
1075
	assertSearchResults(
1101
	assertSearchResults(
1076
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1102
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1077
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
1103
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
Lines 1080-1092 Link Here
1080
	);
1106
	);
1081
}
1107
}
1082
public void testBug80264_MethodsIgnoreDeclaringType() throws CoreException, JavaModelException {
1108
public void testBug80264_MethodsIgnoreDeclaringType() throws CoreException, JavaModelException {
1083
	assertNotNull("There should be working copies!", workingCopies);
1109
	setUpBug80264_Methods();
1084
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1085
	IType type = workingCopies[0].getType("Methods");
1110
	IType type = workingCopies[0].getType("Methods");
1086
	IMethod[] methods = type.getMethods();
1111
	IMethod[] methods = type.getMethods();
1087
	search(methods[0], DECLARATIONS|IGNORE_DECLARING_TYPE);
1112
	search(methods[0], DECLARATIONS|IGNORE_DECLARING_TYPE);
1088
	search(methods[1], DECLARATIONS|IGNORE_DECLARING_TYPE);
1113
	search(methods[1], DECLARATIONS|IGNORE_DECLARING_TYPE);
1089
	this.discard = false;
1090
	assertSearchResults(
1114
	assertSearchResults(
1091
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1115
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1092
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
1116
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
Lines 1096-1108 Link Here
1096
	);
1120
	);
1097
}
1121
}
1098
public void testBug80264_MethodsIgnoreReturnType() throws CoreException, JavaModelException {
1122
public void testBug80264_MethodsIgnoreReturnType() throws CoreException, JavaModelException {
1099
	assertNotNull("There should be working copies!", workingCopies);
1123
	setUpBug80264_Methods();
1100
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1101
	IType type = workingCopies[0].getType("Methods");
1124
	IType type = workingCopies[0].getType("Methods");
1102
	IMethod[] methods = type.getMethods();
1125
	IMethod[] methods = type.getMethods();
1103
	search(methods[0], DECLARATIONS|IGNORE_RETURN_TYPE);
1126
	search(methods[0], DECLARATIONS|IGNORE_RETURN_TYPE);
1104
	search(methods[1], DECLARATIONS|IGNORE_RETURN_TYPE);
1127
	search(methods[1], DECLARATIONS|IGNORE_RETURN_TYPE);
1105
	this.discard = false;
1106
	assertSearchResults(
1128
	assertSearchResults(
1107
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1129
		"src/b80264/Methods.java Methods b80264.Methods.stable() [stable] EXACT_MATCH\n" + 
1108
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
1130
		"src/b80264/Methods.java Methods b80264.MethodsSub.stable() [stable] EXACT_MATCH\n" + 
Lines 1111-1118 Link Here
1111
	);
1133
	);
1112
}
1134
}
1113
public void testBug80264_MethodsIgnoreBothTypes() throws CoreException, JavaModelException {
1135
public void testBug80264_MethodsIgnoreBothTypes() throws CoreException, JavaModelException {
1114
	assertNotNull("There should be working copies!", workingCopies);
1136
	setUpBug80264_Methods();
1115
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1116
	IType type = workingCopies[0].getType("Methods");
1137
	IType type = workingCopies[0].getType("Methods");
1117
	IMethod[] methods = type.getMethods();
1138
	IMethod[] methods = type.getMethods();
1118
	search(methods[0], DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
1139
	search(methods[0], DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
Lines 1127-1133 Link Here
1127
	);
1148
	);
1128
}
1149
}
1129
// Classes
1150
// Classes
1130
public void testBug80264_Classes() throws CoreException {
1151
private void setUpBug80264_Classes() throws CoreException {
1131
	workingCopies = new ICompilationUnit[1];
1152
	workingCopies = new ICompilationUnit[1];
1132
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Classes.java",
1153
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Classes.java",
1133
		"package b80264;\n" + 
1154
		"package b80264;\n" + 
Lines 1141-1159 Link Here
1141
		"    class Inner {}\n" + 
1162
		"    class Inner {}\n" + 
1142
		"}\n"
1163
		"}\n"
1143
	);
1164
	);
1165
}
1166
public void testBug80264_Classes() throws CoreException {
1167
	setUpBug80264_Classes();
1144
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1168
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1145
	search(type, DECLARATIONS);
1169
	search(type, DECLARATIONS);
1146
	this.discard = false;
1147
	assertSearchResults(
1170
	assertSearchResults(
1148
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH"
1171
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH"
1149
	);
1172
	);
1150
}
1173
}
1151
public void testBug80264_ClassesIgnoreDeclaringType() throws CoreException, JavaModelException {
1174
public void testBug80264_ClassesIgnoreDeclaringType() throws CoreException, JavaModelException {
1152
	assertNotNull("There should be working copies!", workingCopies);
1175
	setUpBug80264_Classes();
1153
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1154
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1176
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1155
	search(type, DECLARATIONS|IGNORE_DECLARING_TYPE);
1177
	search(type, DECLARATIONS|IGNORE_DECLARING_TYPE);
1156
	this.discard = false;
1157
	assertSearchResults(
1178
	assertSearchResults(
1158
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH\n" + 
1179
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH\n" + 
1159
		"src/b80264/Classes.java b80264.ClassesSub$Inner [Inner] EXACT_MATCH\n" + 
1180
		"src/b80264/Classes.java b80264.ClassesSub$Inner [Inner] EXACT_MATCH\n" + 
Lines 1161-1178 Link Here
1161
	);
1182
	);
1162
}
1183
}
1163
public void testBug80264_ClassesIgnoreReturnType() throws CoreException, JavaModelException {
1184
public void testBug80264_ClassesIgnoreReturnType() throws CoreException, JavaModelException {
1164
	assertNotNull("There should be working copies!", workingCopies);
1185
	setUpBug80264_Classes();
1165
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1166
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1186
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1167
	search(type, DECLARATIONS|IGNORE_RETURN_TYPE);
1187
	search(type, DECLARATIONS|IGNORE_RETURN_TYPE);
1168
	this.discard = false;
1169
	assertSearchResults(
1188
	assertSearchResults(
1170
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH"
1189
		"src/b80264/Classes.java b80264.Classes$Inner [Inner] EXACT_MATCH"
1171
	);
1190
	);
1172
}
1191
}
1173
public void testBug80264_ClassesIgnoreTypes() throws CoreException, JavaModelException {
1192
public void testBug80264_ClassesIgnoreTypes() throws CoreException, JavaModelException {
1174
	assertNotNull("There should be working copies!", workingCopies);
1193
	setUpBug80264_Classes();
1175
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1176
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1194
	IType type = workingCopies[0].getType("Classes").getType("Inner");
1177
	search(type, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
1195
	search(type, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
1178
	assertSearchResults(
1196
	assertSearchResults(
Lines 1182-1188 Link Here
1182
	);
1200
	);
1183
}
1201
}
1184
// Fields
1202
// Fields
1185
public void testBug80264_Fields() throws CoreException {
1203
private void setUpBug80264_Fields() throws CoreException {
1186
	workingCopies = new ICompilationUnit[1];
1204
	workingCopies = new ICompilationUnit[1];
1187
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Fields.java",
1205
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b80264/Fields.java",
1188
		"package b80264;\n" + 
1206
		"package b80264;\n" + 
Lines 1199-1222 Link Here
1199
		"    Fields field2;\n" + 
1217
		"    Fields field2;\n" + 
1200
		"}\n"
1218
		"}\n"
1201
	);
1219
	);
1220
}
1221
public void testBug80264_Fields() throws CoreException {
1222
	setUpBug80264_Fields();
1202
	IType type = workingCopies[0].getType("Fields");
1223
	IType type = workingCopies[0].getType("Fields");
1203
	IField[] fields = type.getFields();
1224
	IField[] fields = type.getFields();
1204
	search(fields[0], DECLARATIONS);
1225
	search(fields[0], DECLARATIONS);
1205
	search(fields[1], DECLARATIONS);
1226
	search(fields[1], DECLARATIONS);
1206
	this.discard = false;
1207
	assertSearchResults(
1227
	assertSearchResults(
1208
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1228
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1209
		"src/b80264/Fields.java b80264.Fields.field2 [field2] EXACT_MATCH"
1229
		"src/b80264/Fields.java b80264.Fields.field2 [field2] EXACT_MATCH"
1210
	);
1230
	);
1211
}
1231
}
1212
public void testBug80264_FieldsIgnoreDeclaringType() throws CoreException, JavaModelException {
1232
public void testBug80264_FieldsIgnoreDeclaringType() throws CoreException, JavaModelException {
1213
	assertNotNull("There should be working copies!", workingCopies);
1233
	setUpBug80264_Fields();
1214
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1215
	IType type = workingCopies[0].getType("Fields");
1234
	IType type = workingCopies[0].getType("Fields");
1216
	IField[] fields = type.getFields();
1235
	IField[] fields = type.getFields();
1217
	search(fields[0], DECLARATIONS|IGNORE_DECLARING_TYPE);
1236
	search(fields[0], DECLARATIONS|IGNORE_DECLARING_TYPE);
1218
	search(fields[1], DECLARATIONS|IGNORE_DECLARING_TYPE);
1237
	search(fields[1], DECLARATIONS|IGNORE_DECLARING_TYPE);
1219
	this.discard = false;
1220
	assertSearchResults(
1238
	assertSearchResults(
1221
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1239
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1222
		"src/b80264/Fields.java b80264.FieldsSub.field1 [field1] EXACT_MATCH\n" + 
1240
		"src/b80264/Fields.java b80264.FieldsSub.field1 [field1] EXACT_MATCH\n" + 
Lines 1226-1246 Link Here
1226
	);
1244
	);
1227
}
1245
}
1228
public void testBug80264_FieldsIgnoreReturnType() throws CoreException, JavaModelException {
1246
public void testBug80264_FieldsIgnoreReturnType() throws CoreException, JavaModelException {
1229
	assertNotNull("There should be working copies!", workingCopies);
1247
	setUpBug80264_Fields();
1230
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1231
	IType type = workingCopies[0].getType("Fields");
1248
	IType type = workingCopies[0].getType("Fields");
1232
	IField[] fields = type.getFields();
1249
	IField[] fields = type.getFields();
1233
	search(fields[0], DECLARATIONS|IGNORE_RETURN_TYPE);
1250
	search(fields[0], DECLARATIONS|IGNORE_RETURN_TYPE);
1234
	search(fields[1], DECLARATIONS|IGNORE_RETURN_TYPE);
1251
	search(fields[1], DECLARATIONS|IGNORE_RETURN_TYPE);
1235
	this.discard = false;
1236
	assertSearchResults(
1252
	assertSearchResults(
1237
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1253
		"src/b80264/Fields.java b80264.Fields.field1 [field1] EXACT_MATCH\n" + 
1238
		"src/b80264/Fields.java b80264.Fields.field2 [field2] EXACT_MATCH"
1254
		"src/b80264/Fields.java b80264.Fields.field2 [field2] EXACT_MATCH"
1239
	);
1255
	);
1240
}
1256
}
1241
public void testBug80264_FieldsIgnoreBothTypes() throws CoreException, JavaModelException {
1257
public void testBug80264_FieldsIgnoreBothTypes() throws CoreException, JavaModelException {
1242
	assertNotNull("There should be working copies!", workingCopies);
1258
	setUpBug80264_Fields();
1243
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1244
	IType type = workingCopies[0].getType("Fields");
1259
	IType type = workingCopies[0].getType("Fields");
1245
	IField[] fields = type.getFields();
1260
	IField[] fields = type.getFields();
1246
	search(fields[0], DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
1261
	search(fields[0], DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
Lines 1325-1345 Link Here
1325
		"		}\n" + 
1340
		"		}\n" + 
1326
		"	}\n" + 
1341
		"	}\n" + 
1327
		"}\n"
1342
		"}\n"
1328
		);
1343
	);
1329
	IType type = workingCopies[0].getType("Test").getType("Inner");
1344
	IType type = workingCopies[0].getType("Test").getType("Inner");
1330
	IField field1 = type.getField("fList1");
1345
	IField field1 = type.getField("fList1");
1331
	search(field1, REFERENCES);
1346
	search(field1, REFERENCES);
1332
	IField field2 = type.getField("fList2");
1347
	IField field2 = type.getField("fList2");
1333
	search(field2, REFERENCES);
1348
	search(field2, REFERENCES);
1334
	discard = false; // keep working copies for next test (set before assertion as an error is raised...)
1335
	assertSearchResults(
1349
	assertSearchResults(
1336
		"src/b81084a/Test.java b81084a.Test$Inner(List<Element>) [fList1] EXACT_MATCH\n" + 
1350
		"src/b81084a/Test.java b81084a.Test$Inner(List<Element>) [fList1] EXACT_MATCH\n" + 
1337
		"src/b81084a/Test.java b81084a.Test$Inner(List<Element>) [fList2] EXACT_MATCH"
1351
		"src/b81084a/Test.java b81084a.Test$Inner(List<Element>) [fList2] EXACT_MATCH"
1338
	);
1352
	);
1339
}
1353
}
1340
public void testBug81084string() throws CoreException, JavaModelException {
1354
public void testBug81084string() throws CoreException, JavaModelException {
1341
	assertNotNull("There should be working copies!", workingCopies);
1355
	workingCopies = new ICompilationUnit[1];
1342
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1356
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b81084a/Test.java",
1357
		"package b81084a;\n" + 
1358
		"class List<E> {}\n" + 
1359
		"public class Test {\n" + 
1360
		"	class Element{}\n" + 
1361
		"	static class Inner {\n" + 
1362
		"		private final List<Element> fList1;\n" + 
1363
		"		private final List<Test.Element> fList2;\n" + 
1364
		"		public Inner(List<Element> list) {\n" + 
1365
		"			fList1 = list;\n" + 
1366
		"			fList2 = list;\n" + 
1367
		"		}\n" + 
1368
		"	}\n" + 
1369
		"}\n"
1370
	);
1343
	search("fList1", FIELD, REFERENCES);
1371
	search("fList1", FIELD, REFERENCES);
1344
	search("fList2", FIELD, REFERENCES);
1372
	search("fList2", FIELD, REFERENCES);
1345
	assertSearchResults(
1373
	assertSearchResults(
Lines 1445-1452 Link Here
1445
 * Bug 82208: [1.5][search][annot] Search for annotations misses references in default and values constructs
1473
 * Bug 82208: [1.5][search][annot] Search for annotations misses references in default and values constructs
1446
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=82208"
1474
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=82208"
1447
 */
1475
 */
1448
public void testBug82208_TYPE() throws CoreException {
1476
private void setUpBug82208() throws CoreException {
1449
	resultCollector.showRule = true;
1450
	workingCopies = new ICompilationUnit[1];
1477
	workingCopies = new ICompilationUnit[1];
1451
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b82208/Test.java",
1478
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b82208/Test.java",
1452
		"package b82208;\n" + 
1479
		"package b82208;\n" + 
Lines 1455-1462 Link Here
1455
		"@interface B82208_A {}\n" + 
1482
		"@interface B82208_A {}\n" + 
1456
		"public class B82208 {}\n"
1483
		"public class B82208 {}\n"
1457
	);
1484
	);
1485
}
1486
public void testBug82208_TYPE() throws CoreException {
1487
	resultCollector.showRule = true;
1488
	setUpBug82208();
1458
	search("B82208*", TYPE, ALL_OCCURRENCES);
1489
	search("B82208*", TYPE, ALL_OCCURRENCES);
1459
	this.discard = false;
1460
	assertSearchResults(
1490
	assertSearchResults(
1461
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH\n" + 
1491
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH\n" + 
1462
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH\n" + 
1492
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH\n" + 
Lines 1466-1515 Link Here
1466
}
1496
}
1467
public void testBug82208_CLASS() throws CoreException {
1497
public void testBug82208_CLASS() throws CoreException {
1468
	resultCollector.showRule = true;
1498
	resultCollector.showRule = true;
1469
	assertNotNull("There should be working copies!", workingCopies);
1499
	setUpBug82208();
1470
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1471
	search("B82208*", CLASS, ALL_OCCURRENCES);
1500
	search("B82208*", CLASS, ALL_OCCURRENCES);
1472
	this.discard = false;
1473
	assertSearchResults(
1501
	assertSearchResults(
1474
		"src/b82208/Test.java b82208.B82208 [B82208] EXACT_MATCH"
1502
		"src/b82208/Test.java b82208.B82208 [B82208] EXACT_MATCH"
1475
	);
1503
	);
1476
}
1504
}
1477
public void testBug82208_INTERFACE() throws CoreException {
1505
public void testBug82208_INTERFACE() throws CoreException {
1478
	resultCollector.showRule = true;
1506
	resultCollector.showRule = true;
1479
	assertNotNull("There should be working copies!", workingCopies);
1507
	setUpBug82208();
1480
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1481
	search("B82208*", INTERFACE, ALL_OCCURRENCES);
1508
	search("B82208*", INTERFACE, ALL_OCCURRENCES);
1482
	this.discard = false;
1483
	assertSearchResults(
1509
	assertSearchResults(
1484
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH"
1510
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH"
1485
	);
1511
	);
1486
}
1512
}
1487
public void testBug82208_ENUM() throws CoreException {
1513
public void testBug82208_ENUM() throws CoreException {
1488
	resultCollector.showRule = true;
1514
	resultCollector.showRule = true;
1489
	assertNotNull("There should be working copies!", workingCopies);
1515
	setUpBug82208();
1490
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1491
	search("B82208*", ENUM, ALL_OCCURRENCES);
1516
	search("B82208*", ENUM, ALL_OCCURRENCES);
1492
	this.discard = false;
1493
	assertSearchResults(
1517
	assertSearchResults(
1494
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH"
1518
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH"
1495
	);
1519
	);
1496
}
1520
}
1497
public void testBug82208_ANNOTATION_TYPE() throws CoreException {
1521
public void testBug82208_ANNOTATION_TYPE() throws CoreException {
1498
	resultCollector.showRule = true;
1522
	resultCollector.showRule = true;
1499
	assertNotNull("There should be working copies!", workingCopies);
1523
	setUpBug82208();
1500
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1501
	search("B82208*", ANNOTATION_TYPE, ALL_OCCURRENCES);
1524
	search("B82208*", ANNOTATION_TYPE, ALL_OCCURRENCES);
1502
	this.discard = false;
1503
	assertSearchResults(
1525
	assertSearchResults(
1504
		"src/b82208/Test.java b82208.B82208_A [B82208_A] EXACT_MATCH"
1526
		"src/b82208/Test.java b82208.B82208_A [B82208_A] EXACT_MATCH"
1505
	);
1527
	);
1506
}
1528
}
1507
public void testBug82208_CLASS_AND_INTERFACE() throws CoreException {
1529
public void testBug82208_CLASS_AND_INTERFACE() throws CoreException {
1508
	resultCollector.showRule = true;
1530
	resultCollector.showRule = true;
1509
	assertNotNull("There should be working copies!", workingCopies);
1531
	setUpBug82208();
1510
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1511
	search("B82208*", CLASS_AND_INTERFACE, ALL_OCCURRENCES);
1532
	search("B82208*", CLASS_AND_INTERFACE, ALL_OCCURRENCES);
1512
	this.discard = false;
1513
	assertSearchResults(
1533
	assertSearchResults(
1514
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH\n" + 
1534
		"src/b82208/Test.java b82208.B82208_I [B82208_I] EXACT_MATCH\n" + 
1515
		"src/b82208/Test.java b82208.B82208 [B82208] EXACT_MATCH"
1535
		"src/b82208/Test.java b82208.B82208 [B82208] EXACT_MATCH"
Lines 1517-1524 Link Here
1517
}
1537
}
1518
public void testBug82208_CLASS_AND_ENUMERATION() throws CoreException {
1538
public void testBug82208_CLASS_AND_ENUMERATION() throws CoreException {
1519
	resultCollector.showRule = true;
1539
	resultCollector.showRule = true;
1520
	assertNotNull("There should be working copies!", workingCopies);
1540
	setUpBug82208();
1521
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1522
	search("B82208*", CLASS_AND_ENUM, ALL_OCCURRENCES);
1541
	search("B82208*", CLASS_AND_ENUM, ALL_OCCURRENCES);
1523
	assertSearchResults(
1542
	assertSearchResults(
1524
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH\n" + 
1543
		"src/b82208/Test.java b82208.B82208_E [B82208_E] EXACT_MATCH\n" + 
Lines 1595-1601 Link Here
1595
 * Bug 83230: [1.5][search][annot] search for annotation elements does not seem to be implemented yet
1614
 * Bug 83230: [1.5][search][annot] search for annotation elements does not seem to be implemented yet
1596
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=83230"
1615
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=83230"
1597
 */
1616
 */
1598
public void testBug83230_Explicit() throws CoreException {
1617
private void setUpBug83230_Explicit() throws CoreException {
1599
	resultCollector.showRule = true;
1618
	resultCollector.showRule = true;
1600
	workingCopies = new ICompilationUnit[1];
1619
	workingCopies = new ICompilationUnit[1];
1601
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83230/Test.java",
1620
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83230/Test.java",
Lines 1633-1641 Link Here
1633
		"	int min = Author.ageMin;\n" + 
1652
		"	int min = Author.ageMin;\n" + 
1634
		"}\n"
1653
		"}\n"
1635
	);
1654
	);
1655
}
1656
public void testBug83230_Explicit() throws CoreException {
1657
	resultCollector.showRule = true;
1658
	setUpBug83230_Explicit();
1636
	IMethod method = selectMethod(workingCopies[0], "authorName");
1659
	IMethod method = selectMethod(workingCopies[0], "authorName");
1637
	search(method, REFERENCES);
1660
	search(method, REFERENCES);
1638
	this.discard = false;
1639
	assertSearchResults(
1661
	assertSearchResults(
1640
		"src/b83230/Test.java b83230.Test [authorName] EXACT_MATCH\n" + 
1662
		"src/b83230/Test.java b83230.Test [authorName] EXACT_MATCH\n" + 
1641
		"src/b83230/Test.java b83230.Test.min [authorName] EXACT_MATCH\n" + 
1663
		"src/b83230/Test.java b83230.Test.min [authorName] EXACT_MATCH\n" + 
Lines 1648-1669 Link Here
1648
}
1670
}
1649
public void testBug83230_Explicit01() throws CoreException {
1671
public void testBug83230_Explicit01() throws CoreException {
1650
	resultCollector.showRule = true;
1672
	resultCollector.showRule = true;
1651
	assertNotNull("There should be working copies!", workingCopies);
1673
	setUpBug83230_Explicit();
1652
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1653
	IMethod method = selectMethod(workingCopies[0], "authorName");
1674
	IMethod method = selectMethod(workingCopies[0], "authorName");
1654
	search(method, DECLARATIONS);
1675
	search(method, DECLARATIONS);
1655
	this.discard = false;
1656
	assertSearchResults(
1676
	assertSearchResults(
1657
		"src/b83230/Test.java String[] b83230.Author.authorName() [authorName] EXACT_MATCH"
1677
		"src/b83230/Test.java String[] b83230.Author.authorName() [authorName] EXACT_MATCH"
1658
	);
1678
	);
1659
}
1679
}
1660
public void testBug83230_Explicit02() throws CoreException {
1680
public void testBug83230_Explicit02() throws CoreException {
1661
	resultCollector.showRule = true;
1681
	resultCollector.showRule = true;
1662
	assertNotNull("There should be working copies!", workingCopies);
1682
	setUpBug83230_Explicit();
1663
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1664
	IType type = selectType(workingCopies[0], "Address");
1683
	IType type = selectType(workingCopies[0], "Address");
1665
	search(type, REFERENCES);
1684
	search(type, REFERENCES);
1666
	this.discard = false;
1667
	assertSearchResults(
1685
	assertSearchResults(
1668
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [Author.Address] EXACT_MATCH\n" + 
1686
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [Author.Address] EXACT_MATCH\n" + 
1669
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [Author.Address] EXACT_MATCH"
1687
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [Author.Address] EXACT_MATCH"
Lines 1671-1700 Link Here
1671
}
1689
}
1672
public void testBug83230_Explicit03() throws CoreException {
1690
public void testBug83230_Explicit03() throws CoreException {
1673
	resultCollector.showRule = true;
1691
	resultCollector.showRule = true;
1674
	assertNotNull("There should be working copies!", workingCopies);
1692
	setUpBug83230_Explicit();
1675
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1676
	IMethod method = selectMethod(workingCopies[0], "foo");
1693
	IMethod method = selectMethod(workingCopies[0], "foo");
1677
	search(method, REFERENCES);
1694
	search(method, REFERENCES);
1678
	this.discard = false;
1679
	assertSearchResults(
1695
	assertSearchResults(
1680
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [foo(obj)] EXACT_MATCH"
1696
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [foo(obj)] EXACT_MATCH"
1681
	);
1697
	);
1682
}
1698
}
1683
public void testBug83230_Explicit04() throws CoreException {
1699
public void testBug83230_Explicit04() throws CoreException {
1684
	resultCollector.showRule = true;
1700
	resultCollector.showRule = true;
1685
	assertNotNull("There should be working copies!", workingCopies);
1701
	setUpBug83230_Explicit();
1686
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1687
	IField field = selectField(workingCopies[0], "city");
1702
	IField field = selectField(workingCopies[0], "city");
1688
	search(field, REFERENCES);
1703
	search(field, REFERENCES);
1689
	this.discard = false;
1690
	assertSearchResults(
1704
	assertSearchResults(
1691
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [city] EXACT_MATCH"
1705
		"src/b83230/Test.java String void b83230.Test.foo():Local#1.foo() [city] EXACT_MATCH"
1692
	);
1706
	);
1693
}
1707
}
1694
public void testBug83230_Explicit05() throws CoreException {
1708
public void testBug83230_Explicit05() throws CoreException {
1695
	resultCollector.showRule = true;
1709
	resultCollector.showRule = true;
1696
	assertNotNull("There should be working copies!", workingCopies);
1710
	setUpBug83230_Explicit();
1697
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1698
	IField field = selectField(workingCopies[0], "ageMin");
1711
	IField field = selectField(workingCopies[0], "ageMin");
1699
	search(field, REFERENCES);
1712
	search(field, REFERENCES);
1700
	assertSearchResults(
1713
	assertSearchResults(
Lines 1779-1785 Link Here
1779
		"src/b83304/Test.java void b83304.Test.foo() [Class] EXACT_MATCH"
1792
		"src/b83304/Test.java void b83304.Test.foo() [Class] EXACT_MATCH"
1780
	);
1793
	);
1781
}
1794
}
1782
public void testBug83304_TypeParameterizedElementPattern() throws CoreException {
1795
private void setUpBug83304_TypeParameterizedElementPattern() throws CoreException {
1783
	resultCollector.showRule = true;
1796
	resultCollector.showRule = true;
1784
	workingCopies = new ICompilationUnit[1];
1797
	workingCopies = new ICompilationUnit[1];
1785
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Types.java",
1798
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Types.java",
Lines 1793-1802 Link Here
1793
		"	public Generic<? extends Throwable> gen_thr;\n" + 
1806
		"	public Generic<? extends Throwable> gen_thr;\n" + 
1794
		"	public Generic<? super RuntimeException> gen_run;\n" + 
1807
		"	public Generic<? super RuntimeException> gen_run;\n" + 
1795
		"}\n"
1808
		"}\n"
1796
		);
1809
	);
1810
}
1811
public void testBug83304_TypeParameterizedElementPattern() throws CoreException {
1812
	resultCollector.showRule = true;
1813
	setUpBug83304_TypeParameterizedElementPattern();
1797
	IType type = selectType(workingCopies[0], "Generic", 4);
1814
	IType type = selectType(workingCopies[0], "Generic", 4);
1798
	search(type, REFERENCES, ERASURE_RULE);
1815
	search(type, REFERENCES, ERASURE_RULE);
1799
	discard = false; // use working copy for next test
1800
	assertSearchResults(
1816
	assertSearchResults(
1801
		"src/b83304/Types.java [g1.t.s.def.Generic] EQUIVALENT_RAW_MATCH\n" + 
1817
		"src/b83304/Types.java [g1.t.s.def.Generic] EQUIVALENT_RAW_MATCH\n" + 
1802
		"src/b83304/Types.java b83304.Types.gen [Generic] EQUIVALENT_RAW_MATCH\n" + 
1818
		"src/b83304/Types.java b83304.Types.gen [Generic] EQUIVALENT_RAW_MATCH\n" + 
Lines 1810-1820 Link Here
1810
}
1826
}
1811
public void testBug83304_TypeGenericElementPattern() throws CoreException {
1827
public void testBug83304_TypeGenericElementPattern() throws CoreException {
1812
	resultCollector.showRule = true;
1828
	resultCollector.showRule = true;
1813
	assertNotNull("There should be working copies!", workingCopies);
1829
	setUpBug83304_TypeParameterizedElementPattern();
1814
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1815
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g1.t.s.def", "Generic.class").getType();
1830
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g1.t.s.def", "Generic.class").getType();
1816
	search(type, REFERENCES, ERASURE_RULE);
1831
	search(type, REFERENCES, ERASURE_RULE);
1817
	discard = false; // use working copy for next test
1818
	assertSearchResults(
1832
	assertSearchResults(
1819
		"src/b83304/Types.java [g1.t.s.def.Generic] EQUIVALENT_RAW_MATCH\n" + 
1833
		"src/b83304/Types.java [g1.t.s.def.Generic] EQUIVALENT_RAW_MATCH\n" + 
1820
		"src/b83304/Types.java b83304.Types.gen [Generic] ERASURE_RAW_MATCH\n" + 
1834
		"src/b83304/Types.java b83304.Types.gen [Generic] ERASURE_RAW_MATCH\n" + 
Lines 1828-1835 Link Here
1828
}
1842
}
1829
public void testBug83304_TypeStringPattern() throws CoreException {
1843
public void testBug83304_TypeStringPattern() throws CoreException {
1830
	resultCollector.showRule = true;
1844
	resultCollector.showRule = true;
1831
	assertNotNull("There should be working copies!", workingCopies);
1845
	setUpBug83304_TypeParameterizedElementPattern();
1832
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1833
	search("Generic<? super Exception>", TYPE, REFERENCES, ERASURE_RULE);
1846
	search("Generic<? super Exception>", TYPE, REFERENCES, ERASURE_RULE);
1834
	assertSearchResults(
1847
	assertSearchResults(
1835
		"src/b83304/Types.java [Generic] EQUIVALENT_RAW_MATCH\n" + 
1848
		"src/b83304/Types.java [Generic] EQUIVALENT_RAW_MATCH\n" + 
Lines 1842-1848 Link Here
1842
		"lib/JavaSearch15.jar g1.t.s.def.Generic<T> g1.t.s.def.Generic.foo() ERASURE_MATCH"
1855
		"lib/JavaSearch15.jar g1.t.s.def.Generic<T> g1.t.s.def.Generic.foo() ERASURE_MATCH"
1843
	);
1856
	);
1844
}
1857
}
1845
public void testBug83304_MethodParameterizedElementPattern() throws CoreException {
1858
private void setUpBug83304_MethodParameterizedElementPattern() throws CoreException {
1846
	resultCollector.showRule = true;
1859
	resultCollector.showRule = true;
1847
	workingCopies = new ICompilationUnit[1];
1860
	workingCopies = new ICompilationUnit[1];
1848
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Methods.java",
1861
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Methods.java",
Lines 1857-1866 Link Here
1857
		"		gs.<String>generic(\"\");\n" + 
1870
		"		gs.<String>generic(\"\");\n" + 
1858
		"	}\n" + 
1871
		"	}\n" + 
1859
		"}\n"
1872
		"}\n"
1860
		);
1873
	);
1874
}
1875
public void testBug83304_MethodParameterizedElementPattern() throws CoreException {
1876
	resultCollector.showRule = true;
1877
	setUpBug83304_MethodParameterizedElementPattern();
1861
	IMethod method = selectMethod(workingCopies[0], "generic", 2);
1878
	IMethod method = selectMethod(workingCopies[0], "generic", 2);
1862
	search(method, REFERENCES, ERASURE_RULE);
1879
	search(method, REFERENCES, ERASURE_RULE);
1863
	discard = false; // use working copy for next test
1864
	assertSearchResults(
1880
	assertSearchResults(
1865
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1881
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1866
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] EXACT_MATCH\n" + 
1882
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] EXACT_MATCH\n" + 
Lines 1869-1880 Link Here
1869
}
1885
}
1870
public void testBug83304_MethodGenericElementPattern() throws CoreException {
1886
public void testBug83304_MethodGenericElementPattern() throws CoreException {
1871
	resultCollector.showRule = true;
1887
	resultCollector.showRule = true;
1872
	assertNotNull("There should be working copies!", workingCopies);
1888
	setUpBug83304_MethodParameterizedElementPattern();
1873
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1874
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g5.m.def", "Single.class").getType();
1889
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g5.m.def", "Single.class").getType();
1875
	IMethod method = type.getMethod("generic", new String[] { "TU;" });
1890
	IMethod method = type.getMethod("generic", new String[] { "TU;" });
1876
	search(method, REFERENCES, ERASURE_RULE);
1891
	search(method, REFERENCES, ERASURE_RULE);
1877
	discard = false; // use working copy for next test
1878
	assertSearchResults(
1892
	assertSearchResults(
1879
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1893
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1880
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1894
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
Lines 1883-1890 Link Here
1883
}
1897
}
1884
public void testBug83304_MethodStringPattern() throws CoreException {
1898
public void testBug83304_MethodStringPattern() throws CoreException {
1885
	resultCollector.showRule = true;
1899
	resultCollector.showRule = true;
1886
	assertNotNull("There should be working copies!", workingCopies);
1900
	setUpBug83304_MethodParameterizedElementPattern();
1887
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1888
	search("<Exception>generic", METHOD, REFERENCES, ERASURE_RULE);
1901
	search("<Exception>generic", METHOD, REFERENCES, ERASURE_RULE);
1889
	assertSearchResults(
1902
	assertSearchResults(
1890
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
1903
		"src/b83304/Methods.java void b83304.Methods.test() [generic(exc)] ERASURE_MATCH\n" + 
Lines 1892-1898 Link Here
1892
		"src/b83304/Methods.java void b83304.Methods.test() [generic(\"\")] ERASURE_MATCH"
1905
		"src/b83304/Methods.java void b83304.Methods.test() [generic(\"\")] ERASURE_MATCH"
1893
	);
1906
	);
1894
}
1907
}
1895
public void testBug83304_ConstructorGenericElementPattern() throws CoreException {
1908
private void setUpBug83304_ConstructorGenericElementPattern() throws CoreException {
1896
	resultCollector.showRule = true;
1909
	resultCollector.showRule = true;
1897
	workingCopies = new ICompilationUnit[1];
1910
	workingCopies = new ICompilationUnit[1];
1898
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Constructors.java",
1911
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83304/Constructors.java",
Lines 1906-1915 Link Here
1906
		"		new <String>Single<String>(\"\", \"\");\n" + 
1919
		"		new <String>Single<String>(\"\", \"\");\n" + 
1907
		"	}\n" + 
1920
		"	}\n" + 
1908
		"}\n"
1921
		"}\n"
1909
		);
1922
	);
1923
}
1924
public void testBug83304_ConstructorGenericElementPattern() throws CoreException {
1925
	resultCollector.showRule = true;
1926
	setUpBug83304_ConstructorGenericElementPattern();
1910
	IMethod method = selectMethod(workingCopies[0], "Single", 3);
1927
	IMethod method = selectMethod(workingCopies[0], "Single", 3);
1911
	search(method, REFERENCES, ERASURE_RULE);
1928
	search(method, REFERENCES, ERASURE_RULE);
1912
	discard = false; // use working copy for next test
1913
	assertSearchResults(
1929
	assertSearchResults(
1914
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1930
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1915
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Exception>Single<String>(\"\", exc)] EXACT_MATCH\n" + 
1931
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Exception>Single<String>(\"\", exc)] EXACT_MATCH\n" + 
Lines 1918-1929 Link Here
1918
}
1934
}
1919
public void testBug83304_ConstructorParameterizedElementPattern() throws CoreException {
1935
public void testBug83304_ConstructorParameterizedElementPattern() throws CoreException {
1920
	resultCollector.showRule = true;
1936
	resultCollector.showRule = true;
1921
	assertNotNull("There should be working copies!", workingCopies);
1937
	setUpBug83304_ConstructorGenericElementPattern();
1922
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1923
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g5.c.def", "Single.class").getType();
1938
	IType type = getClassFile("JavaSearchBugs", "lib/JavaSearch15.jar", "g5.c.def", "Single.class").getType();
1924
	IMethod method = type.getMethod("Single", new String[] { "TT;", "TU;" });
1939
	IMethod method = type.getMethod("Single", new String[] { "TT;", "TU;" });
1925
	search(method, REFERENCES, ERASURE_RULE);
1940
	search(method, REFERENCES, ERASURE_RULE);
1926
	discard = false; // use working copy for next test
1927
	assertSearchResults(
1941
	assertSearchResults(
1928
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1942
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1929
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Exception>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1943
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Exception>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
Lines 1932-1939 Link Here
1932
}
1946
}
1933
public void testBug83304_ConstructorStringPattern() throws CoreException {
1947
public void testBug83304_ConstructorStringPattern() throws CoreException {
1934
	resultCollector.showRule = true;
1948
	resultCollector.showRule = true;
1935
	assertNotNull("There should be working copies!", workingCopies);
1949
	setUpBug83304_ConstructorGenericElementPattern();
1936
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
1937
	search("<Exception>Single", CONSTRUCTOR, REFERENCES, ERASURE_RULE);
1950
	search("<Exception>Single", CONSTRUCTOR, REFERENCES, ERASURE_RULE);
1938
	assertSearchResults(
1951
	assertSearchResults(
1939
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
1952
		"src/b83304/Constructors.java void b83304.Constructors.test() [new <Throwable>Single<String>(\"\", exc)] ERASURE_MATCH\n" + 
Lines 1948-1955 Link Here
1948
 * Bug 83804: [1.5][javadoc] Missing Javadoc node for package declaration
1961
 * Bug 83804: [1.5][javadoc] Missing Javadoc node for package declaration
1949
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=83804"
1962
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=83804"
1950
 */
1963
 */
1951
public void testBug83804_Type() throws CoreException {
1964
private void setUpBug83804_Type() throws CoreException {
1952
	resultCollector.showInsideDoc = true;
1953
	workingCopies = new ICompilationUnit[2];
1965
	workingCopies = new ICompilationUnit[2];
1954
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83804/package-info.java",
1966
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83804/package-info.java",
1955
		"/**\n" + 
1967
		"/**\n" + 
Lines 1976-1983 Link Here
1976
		"	public void foo() {}\n" + 
1988
		"	public void foo() {}\n" + 
1977
		"}\n"
1989
		"}\n"
1978
	);
1990
	);
1991
}
1992
public void testBug83804_Type() throws CoreException {
1993
	resultCollector.showInsideDoc = true;
1994
	setUpBug83804_Type();
1979
	IType type = workingCopies[1].getType("Test");
1995
	IType type = workingCopies[1].getType("Test");
1980
	this.discard = false;
1981
	search(type, REFERENCES);
1996
	search(type, REFERENCES);
1982
	assertSearchResults(
1997
	assertSearchResults(
1983
		"src/b83804/package-info.java [Test] EXACT_MATCH INSIDE_JAVADOC\n" + 
1998
		"src/b83804/package-info.java [Test] EXACT_MATCH INSIDE_JAVADOC\n" + 
Lines 1989-1999 Link Here
1989
}
2004
}
1990
public void testBug83804_Method() throws CoreException {
2005
public void testBug83804_Method() throws CoreException {
1991
	resultCollector.showInsideDoc = true;
2006
	resultCollector.showInsideDoc = true;
1992
	assertNotNull("Problem in tests processing", workingCopies);
2007
	setUpBug83804_Type();
1993
	assertEquals("Problem in tests processing", 2, workingCopies.length);
1994
	IMethod[] methods = workingCopies[1].getType("Test").getMethods();
2008
	IMethod[] methods = workingCopies[1].getType("Test").getMethods();
1995
	assertEquals("Invalid number of methods", 1, methods.length);
2009
	assertEquals("Invalid number of methods", 1, methods.length);
1996
	this.discard = false;
1997
	search(methods[0], REFERENCES);
2010
	search(methods[0], REFERENCES);
1998
	assertSearchResults(
2011
	assertSearchResults(
1999
		"src/b83804/package-info.java [foo()] EXACT_MATCH INSIDE_JAVADOC"
2012
		"src/b83804/package-info.java [foo()] EXACT_MATCH INSIDE_JAVADOC"
Lines 2001-2008 Link Here
2001
}
2014
}
2002
public void testBug83804_Field() throws CoreException {
2015
public void testBug83804_Field() throws CoreException {
2003
	resultCollector.showInsideDoc = true;
2016
	resultCollector.showInsideDoc = true;
2004
	assertNotNull("Problem in tests processing", workingCopies);
2017
	setUpBug83804_Type();
2005
	assertEquals("Problem in tests processing", 2, workingCopies.length);
2006
	IField[] fields = workingCopies[1].getType("Test").getFields();
2018
	IField[] fields = workingCopies[1].getType("Test").getFields();
2007
	assertEquals("Invalid number of fields", 1, fields.length);
2019
	assertEquals("Invalid number of fields", 1, fields.length);
2008
	search(fields[0], REFERENCES);
2020
	search(fields[0], REFERENCES);
Lines 2039-2053 Link Here
2039
		resultCollector,
2051
		resultCollector,
2040
		null
2052
		null
2041
	);
2053
	);
2042
	discard = false; // use working copy for next test
2043
	assertSearchResults(
2054
	assertSearchResults(
2044
		"src/b83388/R.java b83388 [No source] EXACT_MATCH"
2055
		"src/b83388/R.java b83388 [No source] EXACT_MATCH"
2045
	);
2056
	);
2046
}
2057
}
2047
public void testBug83388b() throws CoreException {
2058
public void testBug83388b() throws CoreException {
2048
	resultCollector.showRule = true;
2059
	resultCollector.showRule = true;
2049
	assertNotNull("There should be working copies!", workingCopies);
2060
	workingCopies = new ICompilationUnit[1];
2050
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2061
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b83388/R.java",
2062
		"package b83388;\n" + 
2063
		"import b83388.*;\n" + 
2064
		"public class R {}\n"
2065
	);
2051
	IPackageDeclaration packageDeclaration = workingCopies[0].getPackageDeclaration("pack");
2066
	IPackageDeclaration packageDeclaration = workingCopies[0].getPackageDeclaration("pack");
2052
	assertNotNull("Cannot find \"pack\" import declaration for "+workingCopies[0].getElementName(), packageDeclaration);
2067
	assertNotNull("Cannot find \"pack\" import declaration for "+workingCopies[0].getElementName(), packageDeclaration);
2053
	SearchPattern pattern = SearchPattern.createPattern(
2068
	SearchPattern pattern = SearchPattern.createPattern(
Lines 2130-2136 Link Here
2130
 * Bug 84100: [1.5][search] Search for varargs method not finding match
2145
 * Bug 84100: [1.5][search] Search for varargs method not finding match
2131
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84100"
2146
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84100"
2132
 */
2147
 */
2133
public void testBug84100() throws CoreException {
2148
private void setUpBug84100() throws CoreException {
2134
	resultCollector.showRule = true;
2149
	resultCollector.showRule = true;
2135
	workingCopies = new ICompilationUnit[2];
2150
	workingCopies = new ICompilationUnit[2];
2136
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84100/X.java",
2151
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84100/X.java",
Lines 2156-2187 Link Here
2156
		"		x.foo(\"\", 3, \"\", \"\");\n" + 
2171
		"		x.foo(\"\", 3, \"\", \"\");\n" + 
2157
		"	}\n" + 
2172
		"	}\n" + 
2158
		"}\n"
2173
		"}\n"
2159
		);
2174
	);
2175
}
2176
public void testBug84100() throws CoreException {
2177
	resultCollector.showRule = true;
2178
	setUpBug84100();
2160
	IMethod method = selectMethod(workingCopies[0], "foo", 1);
2179
	IMethod method = selectMethod(workingCopies[0], "foo", 1);
2161
	search(method, REFERENCES);
2180
	search(method, REFERENCES);
2162
	discard = false; // use working copy for next test
2163
	assertSearchResults(
2181
	assertSearchResults(
2164
		"src/b84100/Z.java void b84100.Z.foo() [foo()] EXACT_MATCH"
2182
		"src/b84100/Z.java void b84100.Z.foo() [foo()] EXACT_MATCH"
2165
	);
2183
	);
2166
}
2184
}
2167
public void testBug84100b() throws CoreException {
2185
public void testBug84100b() throws CoreException {
2168
	resultCollector.showRule = true;
2186
	resultCollector.showRule = true;
2169
	assertNotNull("There should be working copies!", workingCopies);
2187
	setUpBug84100();
2170
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2171
	IMethod method = selectMethod(workingCopies[0], "foo", 2);
2188
	IMethod method = selectMethod(workingCopies[0], "foo", 2);
2172
	search(method, REFERENCES);
2189
	search(method, REFERENCES);
2173
	discard = false; // use working copy for next test
2174
	assertSearchResults(
2190
	assertSearchResults(
2175
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\")] EXACT_MATCH"
2191
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\")] EXACT_MATCH"
2176
	);
2192
	);
2177
}
2193
}
2178
public void testBug84100c() throws CoreException {
2194
public void testBug84100c() throws CoreException {
2179
	resultCollector.showRule = true;
2195
	resultCollector.showRule = true;
2180
	assertNotNull("There should be working copies!", workingCopies);
2196
	setUpBug84100();
2181
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2182
	IMethod method = selectMethod(workingCopies[0], "foo", 3);
2197
	IMethod method = selectMethod(workingCopies[0], "foo", 3);
2183
	search(method, REFERENCES);
2198
	search(method, REFERENCES);
2184
	discard = false; // use working copy for next test
2185
	assertSearchResults(
2199
	assertSearchResults(
2186
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\", \"\")] EXACT_MATCH\n" + 
2200
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\", \"\")] EXACT_MATCH\n" + 
2187
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\", \"\", null)] EXACT_MATCH"
2201
		"src/b84100/Z.java void b84100.Z.foo() [foo(\"\", \"\", null)] EXACT_MATCH"
Lines 2189-2207 Link Here
2189
}
2203
}
2190
public void testBug84100d() throws CoreException {
2204
public void testBug84100d() throws CoreException {
2191
	resultCollector.showRule = true;
2205
	resultCollector.showRule = true;
2192
	assertNotNull("There should be working copies!", workingCopies);
2206
	setUpBug84100();
2193
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2194
	IMethod method = selectMethod(workingCopies[0], "foo", 4);
2207
	IMethod method = selectMethod(workingCopies[0], "foo", 4);
2195
	search(method, REFERENCES);
2208
	search(method, REFERENCES);
2196
	discard = false; // use working copy for next test
2197
	assertSearchResults(
2209
	assertSearchResults(
2198
		"src/b84100/Z.java void b84100.Z.foo() [foo(3, \"\", \"\")] EXACT_MATCH"
2210
		"src/b84100/Z.java void b84100.Z.foo() [foo(3, \"\", \"\")] EXACT_MATCH"
2199
	);
2211
	);
2200
}
2212
}
2201
public void testBug84100e() throws CoreException {
2213
public void testBug84100e() throws CoreException {
2202
	resultCollector.showRule = true;
2214
	resultCollector.showRule = true;
2203
	assertNotNull("There should be working copies!", workingCopies);
2215
	setUpBug84100();
2204
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2205
	IMethod method = selectMethod(workingCopies[0], "foo", 5);
2216
	IMethod method = selectMethod(workingCopies[0], "foo", 5);
2206
	search(method, REFERENCES);
2217
	search(method, REFERENCES);
2207
	assertSearchResults(
2218
	assertSearchResults(
Lines 2238-2244 Link Here
2238
 * Bug 84724: [1.5][search] Search for varargs method not finding match
2249
 * Bug 84724: [1.5][search] Search for varargs method not finding match
2239
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84724"
2250
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84724"
2240
 */
2251
 */
2241
public void testBug84724() throws CoreException {
2252
private void setUpBug84724() throws CoreException {
2242
	resultCollector.showRule = true;
2253
	resultCollector.showRule = true;
2243
	workingCopies = new ICompilationUnit[2];
2254
	workingCopies = new ICompilationUnit[2];
2244
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84724/X.java",
2255
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84724/X.java",
Lines 2262-2282 Link Here
2262
		"		new X(\"\", 3, \"\", \"\");\n" + 
2273
		"		new X(\"\", 3, \"\", \"\");\n" + 
2263
		"	}\n" + 
2274
		"	}\n" + 
2264
		"}\n"
2275
		"}\n"
2265
		);
2276
	);
2277
}
2278
public void testBug84724() throws CoreException {
2279
	resultCollector.showRule = true;
2280
	setUpBug84724();
2266
	IMethod method = selectMethod(workingCopies[0], "X", 2);
2281
	IMethod method = selectMethod(workingCopies[0], "X", 2);
2267
	search(method, REFERENCES);
2282
	search(method, REFERENCES);
2268
	discard = false; // use working copy for next test
2269
	assertSearchResults(
2283
	assertSearchResults(
2270
		"src/b84724/Z.java void b84724.Z.foo() [new X(\"\")] EXACT_MATCH"
2284
		"src/b84724/Z.java void b84724.Z.foo() [new X(\"\")] EXACT_MATCH"
2271
	);
2285
	);
2272
}
2286
}
2273
public void testBug84724b() throws CoreException {
2287
public void testBug84724b() throws CoreException {
2274
	resultCollector.showRule = true;
2288
	resultCollector.showRule = true;
2275
	assertNotNull("There should be working copies!", workingCopies);
2289
	setUpBug84724();
2276
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2277
	IMethod method = selectMethod(workingCopies[0], "X", 3);
2290
	IMethod method = selectMethod(workingCopies[0], "X", 3);
2278
	search(method, REFERENCES);
2291
	search(method, REFERENCES);
2279
	discard = false; // use working copy for next test
2280
	assertSearchResults(
2292
	assertSearchResults(
2281
		"src/b84724/Z.java void b84724.Z.foo() [new X()] EXACT_MATCH\n" + 
2293
		"src/b84724/Z.java void b84724.Z.foo() [new X()] EXACT_MATCH\n" + 
2282
		"src/b84724/Z.java void b84724.Z.foo() [new X(\"\", \"\")] EXACT_MATCH\n" + 
2294
		"src/b84724/Z.java void b84724.Z.foo() [new X(\"\", \"\")] EXACT_MATCH\n" + 
Lines 2285-2303 Link Here
2285
}
2297
}
2286
public void testBug84724c() throws CoreException {
2298
public void testBug84724c() throws CoreException {
2287
	resultCollector.showRule = true;
2299
	resultCollector.showRule = true;
2288
	assertNotNull("There should be working copies!", workingCopies);
2300
	setUpBug84724();
2289
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2290
	IMethod method = selectMethod(workingCopies[0], "X", 4);
2301
	IMethod method = selectMethod(workingCopies[0], "X", 4);
2291
	search(method, REFERENCES);
2302
	search(method, REFERENCES);
2292
	discard = false; // use working copy for next test
2293
	assertSearchResults(
2303
	assertSearchResults(
2294
		"src/b84724/Z.java void b84724.Z.foo() [new X(3, \"\", \"\")] EXACT_MATCH"
2304
		"src/b84724/Z.java void b84724.Z.foo() [new X(3, \"\", \"\")] EXACT_MATCH"
2295
	);
2305
	);
2296
}
2306
}
2297
public void testBug84724d() throws CoreException {
2307
public void testBug84724d() throws CoreException {
2298
	resultCollector.showRule = true;
2308
	resultCollector.showRule = true;
2299
	assertNotNull("There should be working copies!", workingCopies);
2309
	setUpBug84724();
2300
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2301
	IMethod method = selectMethod(workingCopies[0], "X", 5);
2310
	IMethod method = selectMethod(workingCopies[0], "X", 5);
2302
	search(method, REFERENCES);
2311
	search(method, REFERENCES);
2303
	assertSearchResults(
2312
	assertSearchResults(
Lines 2309-2315 Link Here
2309
 * Bug 84727: [1.5][search] String pattern search does not work with multiply nested types
2318
 * Bug 84727: [1.5][search] String pattern search does not work with multiply nested types
2310
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84727"
2319
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84727"
2311
 */
2320
 */
2312
public void testBug84727() throws CoreException {
2321
private void setUpBug84727() throws CoreException {
2313
	resultCollector.showRule = true;
2322
	resultCollector.showRule = true;
2314
	workingCopies = new ICompilationUnit[3];
2323
	workingCopies = new ICompilationUnit[3];
2315
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84727/A.java",
2324
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b84727/A.java",
Lines 2334-2352 Link Here
2334
		"public interface List<E> {}\n" + 
2343
		"public interface List<E> {}\n" + 
2335
		"interface Set<E> {}\n" + 
2344
		"interface Set<E> {}\n" + 
2336
		"class ArrayList<E> implements List<E> {}"
2345
		"class ArrayList<E> implements List<E> {}"
2337
		);
2346
	);
2347
}
2348
public void testBug84727() throws CoreException {
2349
	resultCollector.showRule = true;
2350
	setUpBug84727();
2338
	IMethod[] methods = workingCopies[0].getType("A").getMethods();
2351
	IMethod[] methods = workingCopies[0].getType("A").getMethods();
2339
	assertEquals("Invalid number of methods", 2, methods.length);
2352
	assertEquals("Invalid number of methods", 2, methods.length);
2340
	search(methods[0], REFERENCES);
2353
	search(methods[0], REFERENCES);
2341
	discard = false; // use working copy for next test
2342
	assertSearchResults(
2354
	assertSearchResults(
2343
		"src/b84727/X.java void b84727.X.foo() [getXYZ(new ArrayList())] EXACT_MATCH"
2355
		"src/b84727/X.java void b84727.X.foo() [getXYZ(new ArrayList())] EXACT_MATCH"
2344
	);
2356
	);
2345
}
2357
}
2346
public void testBug84727b() throws CoreException {
2358
public void testBug84727b() throws CoreException {
2347
	resultCollector.showRule = true;
2359
	resultCollector.showRule = true;
2348
	assertNotNull("There should be working copies!", workingCopies);
2360
	setUpBug84727();
2349
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
2350
	IMethod[] methods = workingCopies[0].getType("A").getMethods();
2361
	IMethod[] methods = workingCopies[0].getType("A").getMethods();
2351
	assertEquals("Invalid number of methods", 2, methods.length);
2362
	assertEquals("Invalid number of methods", 2, methods.length);
2352
	search(methods[1], REFERENCES);
2363
	search(methods[1], REFERENCES);
Lines 2456-2462 Link Here
2456
 * Bug 86380: [1.5][search][annot] Add support to find references inside annotations on a package declaration
2467
 * Bug 86380: [1.5][search][annot] Add support to find references inside annotations on a package declaration
2457
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=86380"
2468
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=86380"
2458
 */
2469
 */
2459
public void testBug86380_Type() throws CoreException {
2470
private void setUpBug86380() throws CoreException {
2460
	resultCollector.showInsideDoc = true;
2471
	resultCollector.showInsideDoc = true;
2461
	workingCopies = new ICompilationUnit[2];
2472
	workingCopies = new ICompilationUnit[2];
2462
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b86380/package-info.java",
2473
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b86380/package-info.java",
Lines 2473-2481 Link Here
2473
		"	public void foo() {}\n" + 
2484
		"	public void foo() {}\n" + 
2474
		"}\n"
2485
		"}\n"
2475
	);
2486
	);
2487
}
2488
public void testBug86380_Type() throws CoreException {
2489
	resultCollector.showInsideDoc = true;
2490
	setUpBug86380();
2476
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2491
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2477
	IType type = unit.getType("Annot");
2492
	IType type = unit.getType("Annot");
2478
	this.discard = false;
2479
	search(type, REFERENCES);
2493
	search(type, REFERENCES);
2480
	assertSearchResults(
2494
	assertSearchResults(
2481
		"src/b86380/Test.java b86380.Test [Annot] EXACT_MATCH OUTSIDE_JAVADOC\n" + 
2495
		"src/b86380/Test.java b86380.Test [Annot] EXACT_MATCH OUTSIDE_JAVADOC\n" + 
Lines 2486-2497 Link Here
2486
}
2500
}
2487
public void testBug86380_Method() throws CoreException {
2501
public void testBug86380_Method() throws CoreException {
2488
	resultCollector.showInsideDoc = true;
2502
	resultCollector.showInsideDoc = true;
2489
	assertNotNull("There should be working copies!", workingCopies);
2503
	setUpBug86380();
2490
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2491
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2504
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2492
	IMethod[] methods = unit.getType("Annot").getMethods();
2505
	IMethod[] methods = unit.getType("Annot").getMethods();
2493
	assertEquals("Invalid number of methods", 1, methods.length);
2506
	assertEquals("Invalid number of methods", 1, methods.length);
2494
	this.discard = false;
2495
	search(methods[0], REFERENCES);
2507
	search(methods[0], REFERENCES);
2496
	assertSearchResults(
2508
	assertSearchResults(
2497
		"src/b86380/Test.java b86380.Test [12] EXACT_MATCH OUTSIDE_JAVADOC\n" + 
2509
		"src/b86380/Test.java b86380.Test [12] EXACT_MATCH OUTSIDE_JAVADOC\n" + 
Lines 2500-2507 Link Here
2500
}
2512
}
2501
public void testBug86380_Field() throws CoreException {
2513
public void testBug86380_Field() throws CoreException {
2502
	resultCollector.showInsideDoc = true;
2514
	resultCollector.showInsideDoc = true;
2503
	assertNotNull("There should be working copies!", workingCopies);
2515
	setUpBug86380();
2504
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
2505
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2516
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b86380", "Annot.java");
2506
	IField[] fields = unit.getType("Annot").getFields();
2517
	IField[] fields = unit.getType("Annot").getFields();
2507
	assertEquals("Invalid number of fields", 1, fields.length);
2518
	assertEquals("Invalid number of fields", 1, fields.length);
Lines 2597-2613 Link Here
2597
		"        user.aMethod(new Object());\n" + 
2608
		"        user.aMethod(new Object());\n" + 
2598
		"    }\n" + 
2609
		"    }\n" + 
2599
		"}\n"
2610
		"}\n"
2600
		);
2611
	);
2601
	IType type = workingCopies[0].getType("SubClass");
2612
	IType type = workingCopies[0].getType("SubClass");
2602
	search(type.getMethods()[1], REFERENCES);
2613
	search(type.getMethods()[1], REFERENCES);
2603
	discard = false; // keep working copies for next test
2604
	assertSearchResults(
2614
	assertSearchResults(
2605
		"src/b88300/User.java void b88300.User.methodUsingSubClassMethod() [aMethod(new Object())] EXACT_MATCH"
2615
		"src/b88300/User.java void b88300.User.methodUsingSubClassMethod() [aMethod(new Object())] EXACT_MATCH"
2606
	);
2616
	);
2607
}
2617
}
2608
public void testBug88300b() throws CoreException {
2618
public void testBug88300b() throws CoreException {
2609
	assertNotNull("There should be working copies!", workingCopies);
2619
	workingCopies = new ICompilationUnit[3];
2610
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
2611
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b88300/SubClass.java",
2620
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b88300/SubClass.java",
2612
		"package b88300;\n" + 
2621
		"package b88300;\n" + 
2613
		"public class SubClass extends SuperClass {\n" + 
2622
		"public class SubClass extends SuperClass {\n" + 
Lines 2617-2622 Link Here
2617
		"	}\n" + 
2626
		"	}\n" + 
2618
		"}\n"
2627
		"}\n"
2619
	);
2628
	);
2629
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b88300/SuperClass.java",
2630
		"package b88300;\n" + 
2631
		"public class SuperClass {\n" + 
2632
		"    public void aMethod(Object x) {\n" + 
2633
		"    }\n" + 
2634
		"}\n"
2635
		);
2636
	workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/b88300/User.java",
2637
		"package b88300;\n" + 
2638
		"public class User {\n" + 
2639
		"    public void methodUsingSubClassMethod() {\n" + 
2640
		"        SuperClass user = new SubClass();\n" + 
2641
		"        user.aMethod(new Object());\n" + 
2642
		"    }\n" + 
2643
		"}\n"
2644
	);
2620
	IType type = workingCopies[0].getType("SubClass");
2645
	IType type = workingCopies[0].getType("SubClass");
2621
	search(type.getMethods()[0], REFERENCES);
2646
	search(type.getMethods()[0], REFERENCES);
2622
	assertSearchResults(
2647
	assertSearchResults(
Lines 2689-2703 Link Here
2689
	IType type = workingCopies[0].getType("Color");
2714
	IType type = workingCopies[0].getType("Color");
2690
	IMethod method = type.getMethod("Color", new String[0]);
2715
	IMethod method = type.getMethod("Color", new String[0]);
2691
	search(method, REFERENCES);
2716
	search(method, REFERENCES);
2692
	this.discard = false;
2693
	assertSearchResults(
2717
	assertSearchResults(
2694
		"src/b89686/A.java b89686.Color.RED [RED] EXACT_MATCH\n" + 
2718
		"src/b89686/A.java b89686.Color.RED [RED] EXACT_MATCH\n" + 
2695
		"src/b89686/A.java b89686.Color.GREEN [GREEN()] EXACT_MATCH"
2719
		"src/b89686/A.java b89686.Color.GREEN [GREEN()] EXACT_MATCH"
2696
	);
2720
	);
2697
}
2721
}
2698
public void testBug89686b() throws CoreException {
2722
public void testBug89686b() throws CoreException {
2699
	assertNotNull("There should be working copies!", workingCopies);
2723
	workingCopies = new ICompilationUnit[1];
2700
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2724
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b89686/A.java",
2725
		"package b89686;\n" + 
2726
		"public enum Color {\n" + 
2727
		"    RED, GREEN(), BLUE(17), PINK((1+(1+1))) {/*anon*/};\n" + 
2728
		"    Color() {}\n" + 
2729
		"    Color(int i) {}\n" + 
2730
		"}"
2731
	);
2701
	IType type = workingCopies[0].getType("Color");
2732
	IType type = workingCopies[0].getType("Color");
2702
	IMethod method = type.getMethod("Color", new String[] { "I"} );
2733
	IMethod method = type.getMethod("Color", new String[] { "I"} );
2703
	search(method, REFERENCES);
2734
	search(method, REFERENCES);
Lines 2862-2868 Link Here
2862
 * Bug 92944: [1.5][search] SearchEngine#searchAllTypeNames doesn't honor enum or annotation element kind
2893
 * Bug 92944: [1.5][search] SearchEngine#searchAllTypeNames doesn't honor enum or annotation element kind
2863
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=92944"
2894
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=92944"
2864
 */
2895
 */
2865
public void testBug92944_TYPE() throws CoreException {
2896
private void setUpBug92944() throws CoreException {
2866
	resultCollector.showRule = true;
2897
	resultCollector.showRule = true;
2867
	workingCopies = new ICompilationUnit[1];
2898
	workingCopies = new ICompilationUnit[1];
2868
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b92944/Test.java",
2899
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b92944/Test.java",
Lines 2872-2878 Link Here
2872
		"@interface B92944_A {}\n" + 
2903
		"@interface B92944_A {}\n" + 
2873
		"public class B92944 {}\n"
2904
		"public class B92944 {}\n"
2874
	);
2905
	);
2875
	this.discard = false;
2906
}
2907
public void testBug92944_TYPE() throws CoreException {
2908
	resultCollector.showRule = true;
2909
	setUpBug92944();
2876
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2910
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2877
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2911
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2878
		null,
2912
		null,
Lines 2894-2902 Link Here
2894
}
2928
}
2895
public void testBug92944_CLASS() throws CoreException {
2929
public void testBug92944_CLASS() throws CoreException {
2896
	resultCollector.showRule = true;
2930
	resultCollector.showRule = true;
2897
	assertNotNull("There should be working copies!", workingCopies);
2931
	setUpBug92944();
2898
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2899
	this.discard = false;
2900
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2932
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2901
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2933
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2902
		null,
2934
		null,
Lines 2916-2924 Link Here
2916
}
2948
}
2917
public void testBug92944_CLASS_AND_INTERFACE() throws CoreException {
2949
public void testBug92944_CLASS_AND_INTERFACE() throws CoreException {
2918
	resultCollector.showRule = true;
2950
	resultCollector.showRule = true;
2919
	assertNotNull("There should be working copies!", workingCopies);
2951
	setUpBug92944();
2920
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2921
	this.discard = false;
2922
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2952
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2923
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2953
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2924
		null,
2954
		null,
Lines 2939-2947 Link Here
2939
}
2969
}
2940
public void testBug92944_CLASS_AND_ENUM() throws CoreException {
2970
public void testBug92944_CLASS_AND_ENUM() throws CoreException {
2941
	resultCollector.showRule = true;
2971
	resultCollector.showRule = true;
2942
	assertNotNull("There should be working copies!", workingCopies);
2972
	setUpBug92944();
2943
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2944
	this.discard = false;
2945
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2973
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2946
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2974
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2947
		null,
2975
		null,
Lines 2962-2970 Link Here
2962
}
2990
}
2963
public void testBug92944_INTERFACE() throws CoreException {
2991
public void testBug92944_INTERFACE() throws CoreException {
2964
	resultCollector.showRule = true;
2992
	resultCollector.showRule = true;
2965
	assertNotNull("There should be working copies!", workingCopies);
2993
	setUpBug92944();
2966
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2967
	this.discard = false;
2968
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2994
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2969
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2995
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2970
		null,
2996
		null,
Lines 2983-2991 Link Here
2983
}
3009
}
2984
public void testBug92944_ENUM() throws CoreException {
3010
public void testBug92944_ENUM() throws CoreException {
2985
	resultCollector.showRule = true;
3011
	resultCollector.showRule = true;
2986
	assertNotNull("There should be working copies!", workingCopies);
3012
	setUpBug92944();
2987
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
2988
	this.discard = false;
2989
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3013
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
2990
	new SearchEngine(this.workingCopies).searchAllTypeNames(
3014
	new SearchEngine(this.workingCopies).searchAllTypeNames(
2991
		null,
3015
		null,
Lines 3004-3012 Link Here
3004
}
3028
}
3005
public void testBug92944_ANNOTATION_TYPE() throws CoreException {
3029
public void testBug92944_ANNOTATION_TYPE() throws CoreException {
3006
	resultCollector.showRule = true;
3030
	resultCollector.showRule = true;
3007
	assertNotNull("There should be working copies!", workingCopies);
3031
	setUpBug92944();
3008
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3009
	this.discard = false;
3010
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3032
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3011
	new SearchEngine(this.workingCopies).searchAllTypeNames(
3033
	new SearchEngine(this.workingCopies).searchAllTypeNames(
3012
		null,
3034
		null,
Lines 3178-3187 Link Here
3178
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=95794"
3200
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=95794"
3179
 */
3201
 */
3180
public void testBug95794() throws CoreException {
3202
public void testBug95794() throws CoreException {
3181
	workingCopies = new ICompilationUnit[1];
3203
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b95794", "Test.java");
3182
	workingCopies[0] = getCompilationUnit("JavaSearchBugs", "src", "b95794", "Test.java");
3204
	IType type = unit.getType("Test");
3183
	IType type = workingCopies[0].getType("Test");
3184
	this.discard = false;
3185
	
3205
	
3186
	// Verify matches
3206
	// Verify matches
3187
	TestCollector occurencesCollector = new TestCollector();
3207
	TestCollector occurencesCollector = new TestCollector();
Lines 3202-3212 Link Here
3202
}
3222
}
3203
public void testBug95794b() throws CoreException {
3223
public void testBug95794b() throws CoreException {
3204
	resultCollector.showRule = true;
3224
	resultCollector.showRule = true;
3205
	assertNotNull("There should be working copies!", workingCopies);
3225
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b95794", "Test.java");
3206
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3226
	IType type = unit.getType("Test").getType("Color");
3207
	this.discard = false;
3208
	IType type = workingCopies[0].getType("Test").getType("Color");
3209
	this.discard = false;
3210
	
3227
	
3211
	// Verify matches
3228
	// Verify matches
3212
	TestCollector occurencesCollector = new TestCollector();
3229
	TestCollector occurencesCollector = new TestCollector();
Lines 3227-3236 Link Here
3227
}
3244
}
3228
public void testBug95794c() throws CoreException {
3245
public void testBug95794c() throws CoreException {
3229
	resultCollector.showRule = true;
3246
	resultCollector.showRule = true;
3230
	assertNotNull("There should be working copies!", workingCopies);
3247
	ICompilationUnit unit = getCompilationUnit("JavaSearchBugs", "src", "b95794", "Test.java");
3231
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3248
	IField field = unit.getType("Test").getType("Color").getField("WHITE");
3232
	this.discard = false;
3233
	IField field = workingCopies[0].getType("Test").getType("Color").getField("WHITE");
3234
	
3249
	
3235
	// Verify matches
3250
	// Verify matches
3236
	TestCollector occurencesCollector = new TestCollector();
3251
	TestCollector occurencesCollector = new TestCollector();
Lines 3293-3307 Link Here
3293
	);
3308
	);
3294
	IMethod method = workingCopies[0].getType("Sub").getMethods()[0];
3309
	IMethod method = workingCopies[0].getType("Sub").getMethods()[0];
3295
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
3310
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
3296
	this.discard = false;
3297
	assertSearchResults(
3311
	assertSearchResults(
3298
		"src/b96763/Test.java void b96763.Test.first(Exception) [first] EXACT_MATCH\n" + 
3312
		"src/b96763/Test.java void b96763.Test.first(Exception) [first] EXACT_MATCH\n" + 
3299
		"src/b96763/Test.java void b96763.Sub.first(Exception) [first] EXACT_MATCH"
3313
		"src/b96763/Test.java void b96763.Sub.first(Exception) [first] EXACT_MATCH"
3300
	);
3314
	);
3301
}
3315
}
3302
public void testBug96763b() throws CoreException {
3316
public void testBug96763b() throws CoreException {
3303
	assertNotNull("There should be working copies!", workingCopies);
3317
	workingCopies = new ICompilationUnit[1];
3304
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3318
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b96763/Test.java",
3319
		"package b96763;\n" + 
3320
		"class Test<T> {\n" + 
3321
		"    public void first(Exception num) {}\n" + 
3322
		"    public void second(T t) {}\n" + 
3323
		"}\n" + 
3324
		"class Sub extends Test<Exception> {\n" + 
3325
		"    public void first(Exception num) {}\n" + 
3326
		"    public void second(Exception t) {}\n" + 
3327
		"}\n"
3328
	);
3305
	IMethod method = workingCopies[0].getType("Sub").getMethods()[1];
3329
	IMethod method = workingCopies[0].getType("Sub").getMethods()[1];
3306
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
3330
	search(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE);
3307
	assertSearchResults(
3331
	assertSearchResults(
Lines 3610-3624 Link Here
3610
	IType type = getClassFile("JavaSearchBugs", jclPath, "java.lang", "CharSequence.class").getType();
3634
	IType type = getClassFile("JavaSearchBugs", jclPath, "java.lang", "CharSequence.class").getType();
3611
	IMethod method = type.getMethod("length", new String[] {});
3635
	IMethod method = type.getMethod("length", new String[] {});
3612
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type, this.wcOwner));
3636
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type, this.wcOwner));
3613
	this.discard = false;
3614
	assertSearchResults(
3637
	assertSearchResults(
3615
		jclPath + " int java.lang.CharSequence.length() EXACT_MATCH\n" + 
3638
		jclPath + " int java.lang.CharSequence.length() EXACT_MATCH\n" + 
3616
		jclPath + " int java.lang.String.length() EXACT_MATCH"
3639
		jclPath + " int java.lang.String.length() EXACT_MATCH"
3617
	);
3640
	);
3618
}
3641
}
3619
public void testBug98378b() throws CoreException {
3642
public void testBug98378b() throws CoreException {
3620
	assertNotNull("There should be working copies!", workingCopies);
3643
	workingCopies = new ICompilationUnit[2];
3621
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
3644
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b98378/X.java",
3645
		"package b98378;\n" + 
3646
		"public class  X implements java.lang.CharSequence {\n" + 
3647
		"	public int length() {\n" + 
3648
		"		return 1;\n" + 
3649
		"	}\n" + 
3650
		"}"
3651
	);
3652
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b98378/Y.java",
3653
		"package b98378;\n" + 
3654
		"public class Y {\n" + 
3655
		"	public int length() {\n" + 
3656
		"		return -1;\n" + 
3657
		"	}\n" + 
3658
		"}\n"
3659
	);
3622
	String jclPath = getExternalJCLPathString("1.5");
3660
	String jclPath = getExternalJCLPathString("1.5");
3623
	IType type = getClassFile("JavaSearchBugs", jclPath, "java.lang", "CharSequence.class").getType();
3661
	IType type = getClassFile("JavaSearchBugs", jclPath, "java.lang", "CharSequence.class").getType();
3624
	IMethod method = type.getMethod("length", new String[] {});
3662
	IMethod method = type.getMethod("length", new String[] {});
Lines 3682-3695 Link Here
3682
	);
3720
	);
3683
	IType type = workingCopies[2].getType("Annot");
3721
	IType type = workingCopies[2].getType("Annot");
3684
	search(type, REFERENCES);
3722
	search(type, REFERENCES);
3685
	this.discard = false;
3686
	assertSearchResults(
3723
	assertSearchResults(
3687
		"src/b99903/package-info.java [Annot] EXACT_MATCH"
3724
		"src/b99903/package-info.java [Annot] EXACT_MATCH"
3688
	);
3725
	);
3689
}
3726
}
3690
public void testBug99903_javadoc() throws CoreException {
3727
public void testBug99903_javadoc() throws CoreException {
3691
	assertNotNull("There should be working copies!", workingCopies);
3728
	workingCopies = new ICompilationUnit[3];
3692
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
3729
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b99903/package-info.java",
3730
		"/**\n" + 
3731
		" * @see Test\n" + 
3732
		" */\n" + 
3733
		"@Annot\n" + 
3734
		"package b99903;\n"
3735
	);
3736
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b99903/Test.java",
3737
		"package b99903;\n" + 
3738
		"public class Test {\n" + 
3739
		"}\n"
3740
	);
3741
	workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/b99903/Annot.java",
3742
		"package b99903;\n" + 
3743
		"public @interface Annot {\n" + 
3744
		"}\n"
3745
	);
3693
	resultCollector.showInsideDoc = true;
3746
	resultCollector.showInsideDoc = true;
3694
	IType type = workingCopies[1].getType("Test");
3747
	IType type = workingCopies[1].getType("Test");
3695
	search(type, REFERENCES);
3748
	search(type, REFERENCES);
Lines 3716-3730 Link Here
3716
	);
3769
	);
3717
	IField field = workingCopies[0].getType("Test").getField("foo");
3770
	IField field = workingCopies[0].getType("Test").getField("foo");
3718
	search(field, REFERENCES);
3771
	search(field, REFERENCES);
3719
	this.discard = false;
3720
	assertSearchResults(
3772
	assertSearchResults(
3721
		"src/b100695/Test.java b100695.Test.bar [foo] EXACT_MATCH\n" + 
3773
		"src/b100695/Test.java b100695.Test.bar [foo] EXACT_MATCH\n" + 
3722
		"src/b100695/Test.java b100695.Test() [foo] EXACT_MATCH"
3774
		"src/b100695/Test.java b100695.Test() [foo] EXACT_MATCH"
3723
	);
3775
	);
3724
}
3776
}
3725
public void testBug100695a() throws CoreException {
3777
public void testBug100695a() throws CoreException {
3726
	assertNotNull("There should be working copies!", workingCopies);
3778
	workingCopies = new ICompilationUnit[1];
3727
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3779
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100695/Test.java",
3780
		"package b100695;\n" + 
3781
		"public class Test {\n" + 
3782
		"	Class<Class>[] foo;\n" + 
3783
		"	Class<Class>[] bar = foo;\n" + 
3784
		"	Test() {\n" + 
3785
		"		foo = null;\n" + 
3786
		"	}\n" + 
3787
		"}\n"
3788
	);
3728
	IField field = workingCopies[0].getType("Test").getField("foo");
3789
	IField field = workingCopies[0].getType("Test").getField("foo");
3729
	search(field, ALL_OCCURRENCES);
3790
	search(field, ALL_OCCURRENCES);
3730
	assertSearchResults(
3791
	assertSearchResults(
Lines 3838-3844 Link Here
3838
 * Bug 100772: [1.5][search] Search for declarations in hierarchy reports to many matches
3899
 * Bug 100772: [1.5][search] Search for declarations in hierarchy reports to many matches
3839
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=100772"
3900
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=100772"
3840
 */
3901
 */
3841
public void testBug100772_HierarchyScope_ClassAndSubclass01() throws CoreException {
3902
private void setUpBug100772_HierarchyScope_ClassAndSubclass() throws CoreException {
3842
	workingCopies = new ICompilationUnit[1];
3903
	workingCopies = new ICompilationUnit[1];
3843
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
3904
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
3844
		"package b100772;\n" + 
3905
		"package b100772;\n" + 
Lines 3851-3904 Link Here
3851
		"    public void foo(Exception e) {}\n" + 
3912
		"    public void foo(Exception e) {}\n" + 
3852
		"}\n"
3913
		"}\n"
3853
	);
3914
	);
3915
}
3916
public void testBug100772_HierarchyScope_ClassAndSubclass01() throws CoreException {
3917
	setUpBug100772_HierarchyScope_ClassAndSubclass();
3854
	IType type = workingCopies[0].getType("Test");
3918
	IType type = workingCopies[0].getType("Test");
3855
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3919
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3856
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3920
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3857
	this.discard = false;
3858
	assertSearchResults(
3921
	assertSearchResults(
3859
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3922
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3860
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3923
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3861
	);
3924
	);
3862
}
3925
}
3863
public void testBug100772_HierarchyScope_ClassAndSubclass02() throws CoreException {
3926
public void testBug100772_HierarchyScope_ClassAndSubclass02() throws CoreException {
3864
	assertNotNull("There should be working copies!", workingCopies);
3927
	setUpBug100772_HierarchyScope_ClassAndSubclass();
3865
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3866
	IType type = workingCopies[0].getType("Test");
3928
	IType type = workingCopies[0].getType("Test");
3867
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3929
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3868
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3930
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3869
	this.discard = false;
3870
	assertSearchResults(
3931
	assertSearchResults(
3871
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3932
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3872
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3933
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3873
	);
3934
	);
3874
}
3935
}
3875
public void testBug100772_HierarchyScope_ClassAndSubclass03() throws CoreException {
3936
public void testBug100772_HierarchyScope_ClassAndSubclass03() throws CoreException {
3876
	assertNotNull("There should be working copies!", workingCopies);
3937
	setUpBug100772_HierarchyScope_ClassAndSubclass();
3877
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3878
	IType type = workingCopies[0].getType("Test");
3938
	IType type = workingCopies[0].getType("Test");
3879
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
3939
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
3880
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3940
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3881
	this.discard = false;
3882
	assertSearchResults(
3941
	assertSearchResults(
3883
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
3942
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
3884
	);
3943
	);
3885
}
3944
}
3886
public void testBug100772_HierarchyScope_ClassAndSubclass04() throws CoreException {
3945
public void testBug100772_HierarchyScope_ClassAndSubclass04() throws CoreException {
3887
//	org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
3946
	setUpBug100772_HierarchyScope_ClassAndSubclass();
3888
	assertNotNull("There should be working copies!", workingCopies);
3889
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3890
	IType type = workingCopies[0].getType("Sub");
3947
	IType type = workingCopies[0].getType("Sub");
3891
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
3948
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
3892
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3949
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3893
	this.discard = false;
3894
	assertSearchResults(
3950
	assertSearchResults(
3895
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3951
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3896
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3952
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3897
	);
3953
	);
3898
}
3954
}
3899
public void testBug100772_HierarchyScope_ClassAndSubclass05() throws CoreException {
3955
public void testBug100772_HierarchyScope_ClassAndSubclass05() throws CoreException {
3900
	assertNotNull("There should be working copies!", workingCopies);
3956
	setUpBug100772_HierarchyScope_ClassAndSubclass();
3901
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3902
	IType type = workingCopies[0].getType("Sub");
3957
	IType type = workingCopies[0].getType("Sub");
3903
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
3958
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
3904
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3959
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
Lines 3906-3912 Link Here
3906
		"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
3961
		"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
3907
	);
3962
	);
3908
}
3963
}
3909
public void testBug100772_HierarchyScope_InterfacesAndClass01() throws CoreException {
3964
private void setUpBug100772_HierarchyScope_InterfacesAndClass() throws CoreException {
3910
	workingCopies = new ICompilationUnit[1];
3965
	workingCopies = new ICompilationUnit[1];
3911
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
3966
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
3912
		"package b100772;\n" + 
3967
		"package b100772;\n" + 
Lines 3924-3933 Link Here
3924
		"    public void foo(Exception e) {}\n" + 
3979
		"    public void foo(Exception e) {}\n" + 
3925
		"}\n"
3980
		"}\n"
3926
	);
3981
	);
3982
}
3983
public void testBug100772_HierarchyScope_InterfacesAndClass01() throws CoreException {
3984
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3927
	IType type = workingCopies[0].getType("Test");
3985
	IType type = workingCopies[0].getType("Test");
3928
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3986
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3929
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3987
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3930
	this.discard = false;
3931
	assertSearchResults(
3988
	assertSearchResults(
3932
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3989
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3933
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
3990
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
Lines 3935-3946 Link Here
3935
	);
3992
	);
3936
}
3993
}
3937
public void testBug100772_HierarchyScope_InterfacesAndClass02() throws CoreException {
3994
public void testBug100772_HierarchyScope_InterfacesAndClass02() throws CoreException {
3938
	assertNotNull("There should be working copies!", workingCopies);
3995
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3939
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3940
	IType type = workingCopies[0].getType("Test");
3996
	IType type = workingCopies[0].getType("Test");
3941
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3997
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
3942
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3998
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3943
	this.discard = false;
3944
	assertSearchResults(
3999
	assertSearchResults(
3945
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4000
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3946
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4001
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
Lines 3948-4014 Link Here
3948
	);
4003
	);
3949
}
4004
}
3950
public void testBug100772_HierarchyScope_InterfacesAndClass03() throws CoreException {
4005
public void testBug100772_HierarchyScope_InterfacesAndClass03() throws CoreException {
3951
	assertNotNull("There should be working copies!", workingCopies);
4006
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3952
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3953
	IType type = workingCopies[0].getType("Test");
4007
	IType type = workingCopies[0].getType("Test");
3954
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4008
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
3955
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4009
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3956
	this.discard = false;
3957
	assertSearchResults(
4010
	assertSearchResults(
3958
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4011
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
3959
		"src/b100772/Test.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4012
		"src/b100772/Test.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
3960
	);
4013
	);
3961
}
4014
}
3962
public void testBug100772_HierarchyScope_InterfacesAndClass04() throws CoreException {
4015
public void testBug100772_HierarchyScope_InterfacesAndClass04() throws CoreException {
3963
	assertNotNull("There should be working copies!", workingCopies);
4016
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3964
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3965
	IType type = workingCopies[0].getType("Sub");
4017
	IType type = workingCopies[0].getType("Sub");
3966
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4018
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
3967
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4019
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3968
	this.discard = false;
3969
	assertSearchResults(
4020
	assertSearchResults(
3970
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4021
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3971
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
4022
		"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
3972
	);
4023
	);
3973
}
4024
}
3974
public void testBug100772_HierarchyScope_InterfacesAndClass05() throws CoreException {
4025
public void testBug100772_HierarchyScope_InterfacesAndClass05() throws CoreException {
3975
	assertNotNull("There should be working copies!", workingCopies);
4026
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3976
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3977
	IType type = workingCopies[0].getType("Sub");
4027
	IType type = workingCopies[0].getType("Sub");
3978
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4028
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
3979
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4029
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3980
	this.discard = false;
3981
	assertSearchResults(
4030
	assertSearchResults(
3982
		"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
4031
		"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
3983
	);
4032
	);
3984
}
4033
}
3985
public void testBug100772_HierarchyScope_InterfacesAndClass06() throws CoreException {
4034
public void testBug100772_HierarchyScope_InterfacesAndClass06() throws CoreException {
3986
	assertNotNull("There should be working copies!", workingCopies);
4035
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3987
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3988
	IType type = workingCopies[0].getType("X");
4036
	IType type = workingCopies[0].getType("X");
3989
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4037
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
3990
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4038
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3991
	this.discard = false;
3992
	assertSearchResults(
4039
	assertSearchResults(
3993
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4040
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3994
		"src/b100772/Test.java void b100772.X.foo(String) [foo] EXACT_MATCH"
4041
		"src/b100772/Test.java void b100772.X.foo(String) [foo] EXACT_MATCH"
3995
	);
4042
	);
3996
}
4043
}
3997
public void testBug100772_HierarchyScope_InterfacesAndClass07() throws CoreException {
4044
public void testBug100772_HierarchyScope_InterfacesAndClass07() throws CoreException {
3998
	assertNotNull("There should be working copies!", workingCopies);
4045
	setUpBug100772_HierarchyScope_InterfacesAndClass();
3999
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4000
	IType type = workingCopies[0].getType("X");
4046
	IType type = workingCopies[0].getType("X");
4001
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4047
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4002
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4048
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4003
	this.discard = false;
4004
	assertSearchResults(
4049
	assertSearchResults(
4005
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4050
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4006
		"src/b100772/Test.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4051
		"src/b100772/Test.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4007
	);
4052
	);
4008
}
4053
}
4009
public void testBug100772_HierarchyScope_InterfacesAndClass08() throws CoreException {
4054
public void testBug100772_HierarchyScope_InterfacesAndClass08() throws CoreException {
4010
	assertNotNull("There should be working copies!", workingCopies);
4055
	setUpBug100772_HierarchyScope_InterfacesAndClass();
4011
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4012
	IType type = workingCopies[0].getType("X");
4056
	IType type = workingCopies[0].getType("X");
4013
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4057
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4014
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4058
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
Lines 4016-4022 Link Here
4016
		"src/b100772/Test.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4060
		"src/b100772/Test.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4017
	);
4061
	);
4018
}
4062
}
4019
public void testBug100772_HierarchyScope_Complex01() throws CoreException {
4063
private void setUpBug100772_HierarchyScope_Complex() throws CoreException {
4020
	workingCopies = new ICompilationUnit[1];
4064
	workingCopies = new ICompilationUnit[1];
4021
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4065
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4022
		"package b100772;\n" + 
4066
		"package b100772;\n" + 
Lines 4042-4051 Link Here
4042
		"	public void foo(Exception e) {}\n" + 
4086
		"	public void foo(Exception e) {}\n" + 
4043
		"}\n"
4087
		"}\n"
4044
	);
4088
	);
4089
}
4090
public void testBug100772_HierarchyScope_Complex01() throws CoreException {
4091
	setUpBug100772_HierarchyScope_Complex();
4045
	IType type = workingCopies[0].getType("IX");
4092
	IType type = workingCopies[0].getType("IX");
4046
	IMethod method = type.getMethod("foo", new String[] { "QU;" });
4093
	IMethod method = type.getMethod("foo", new String[] { "QU;" });
4047
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
4094
	search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
4048
	this.discard = false;
4049
	assertSearchResults(
4095
	assertSearchResults(
4050
		"src/b100772/Test.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
4096
		"src/b100772/Test.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
4051
		"src/b100772/Test.java void b100772.XX.foo(String) [foo] EXACT_MATCH\n" + 
4097
		"src/b100772/Test.java void b100772.XX.foo(String) [foo] EXACT_MATCH\n" + 
Lines 4055-4066 Link Here
4055
	);
4101
	);
4056
}
4102
}
4057
public void testBug100772_HierarchyScope_Complex02() throws CoreException {
4103
public void testBug100772_HierarchyScope_Complex02() throws CoreException {
4058
	assertNotNull("There should be working copies!", workingCopies);
4104
	setUpBug100772_HierarchyScope_Complex();
4059
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4060
	IType type = workingCopies[0].getType("Z");
4105
	IType type = workingCopies[0].getType("Z");
4061
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4106
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4062
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4107
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4063
	this.discard = false;
4064
	assertSearchResults(
4108
	assertSearchResults(
4065
		"src/b100772/Test.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4109
		"src/b100772/Test.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4066
		"src/b100772/Test.java void b100772.Y.foo(String) [foo] EXACT_MATCH\n" + 
4110
		"src/b100772/Test.java void b100772.Y.foo(String) [foo] EXACT_MATCH\n" + 
Lines 4068-4079 Link Here
4068
	);
4112
	);
4069
}
4113
}
4070
public void testBug100772_HierarchyScope_Complex03() throws CoreException {
4114
public void testBug100772_HierarchyScope_Complex03() throws CoreException {
4071
	assertNotNull("There should be working copies!", workingCopies);
4115
	setUpBug100772_HierarchyScope_Complex();
4072
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4073
	IType type = workingCopies[0].getType("Z");
4116
	IType type = workingCopies[0].getType("Z");
4074
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4117
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4075
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4118
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4076
	this.discard = false;
4077
	assertSearchResults(
4119
	assertSearchResults(
4078
		"src/b100772/Test.java void b100772.Y.foo(Exception) [foo] EXACT_MATCH\n" + 
4120
		"src/b100772/Test.java void b100772.Y.foo(Exception) [foo] EXACT_MATCH\n" + 
4079
		"src/b100772/Test.java void b100772.IXX.foo(V) [foo] EXACT_MATCH\n" + 
4121
		"src/b100772/Test.java void b100772.IXX.foo(V) [foo] EXACT_MATCH\n" + 
Lines 4081-4088 Link Here
4081
	);
4123
	);
4082
}
4124
}
4083
public void testBug100772_HierarchyScope_Complex04() throws CoreException {
4125
public void testBug100772_HierarchyScope_Complex04() throws CoreException {
4084
	assertNotNull("There should be working copies!", workingCopies);
4126
	setUpBug100772_HierarchyScope_Complex();
4085
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4086
	IType type = workingCopies[0].getType("X");
4127
	IType type = workingCopies[0].getType("X");
4087
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4128
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4088
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4129
	search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
Lines 4092-4098 Link Here
4092
		"src/b100772/Test.java void b100772.IX.foo(U) [foo] EXACT_MATCH"
4133
		"src/b100772/Test.java void b100772.IX.foo(U) [foo] EXACT_MATCH"
4093
	);
4134
	);
4094
}
4135
}
4095
public void testBug100772_ProjectScope_ClassAndSubclass01() throws CoreException {
4136
private void setUpBug100772_ProjectScope_ClassAndSubclass() throws CoreException {
4096
	workingCopies = new ICompilationUnit[2];
4137
	workingCopies = new ICompilationUnit[2];
4097
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4138
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4098
		"package b100772;\n" + 
4139
		"package b100772;\n" + 
Lines 4108-4161 Link Here
4108
		"    public void foo(Exception e) {}\n" + 
4149
		"    public void foo(Exception e) {}\n" + 
4109
		"}\n"
4150
		"}\n"
4110
	);
4151
	);
4152
}
4153
public void testBug100772_ProjectScope_ClassAndSubclass01() throws CoreException {
4154
	setUpBug100772_ProjectScope_ClassAndSubclass();
4111
	IType type = workingCopies[0].getType("Test");
4155
	IType type = workingCopies[0].getType("Test");
4112
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4156
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4113
	search(method, UI_DECLARATIONS);
4157
	search(method, UI_DECLARATIONS);
4114
	this.discard = false;
4115
	assertSearchResults(
4158
	assertSearchResults(
4116
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4159
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4117
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4160
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4118
	);
4161
	);
4119
}
4162
}
4120
public void testBug100772_ProjectScope_ClassAndSubclass02() throws CoreException {
4163
public void testBug100772_ProjectScope_ClassAndSubclass02() throws CoreException {
4121
	assertNotNull("There should be working copies!", workingCopies);
4164
	setUpBug100772_ProjectScope_ClassAndSubclass();
4122
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
4123
	IType type = workingCopies[0].getType("Test");
4165
	IType type = workingCopies[0].getType("Test");
4124
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4166
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4125
	search(method, DECLARATIONS);
4167
	search(method, DECLARATIONS);
4126
	this.discard = false;
4127
	assertSearchResults(
4168
	assertSearchResults(
4128
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4169
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4129
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4170
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4130
	);
4171
	);
4131
}
4172
}
4132
public void testBug100772_ProjectScope_ClassAndSubclass03() throws CoreException {
4173
public void testBug100772_ProjectScope_ClassAndSubclass03() throws CoreException {
4133
	assertNotNull("There should be working copies!", workingCopies);
4174
	setUpBug100772_ProjectScope_ClassAndSubclass();
4134
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
4135
	IType type = workingCopies[0].getType("Test");
4175
	IType type = workingCopies[0].getType("Test");
4136
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4176
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4137
	search(method, UI_DECLARATIONS);
4177
	search(method, UI_DECLARATIONS);
4138
	this.discard = false;
4139
	assertSearchResults(
4178
	assertSearchResults(
4140
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
4179
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
4141
	);
4180
	);
4142
}
4181
}
4143
public void testBug100772_ProjectScope_ClassAndSubclass04() throws CoreException {
4182
public void testBug100772_ProjectScope_ClassAndSubclass04() throws CoreException {
4144
//	org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
4183
	setUpBug100772_ProjectScope_ClassAndSubclass();
4145
	assertNotNull("There should be working copies!", workingCopies);
4146
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
4147
	IType type = workingCopies[1].getType("Sub");
4184
	IType type = workingCopies[1].getType("Sub");
4148
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4185
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4149
	search(method, UI_DECLARATIONS);
4186
	search(method, UI_DECLARATIONS);
4150
	this.discard = false;
4151
	assertSearchResults(
4187
	assertSearchResults(
4152
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4188
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4153
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4189
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH"
4154
	);
4190
	);
4155
}
4191
}
4156
public void testBug100772_ProjectScope_ClassAndSubclass05() throws CoreException {
4192
public void testBug100772_ProjectScope_ClassAndSubclass05() throws CoreException {
4157
	assertNotNull("There should be working copies!", workingCopies);
4193
	setUpBug100772_ProjectScope_ClassAndSubclass();
4158
	assertEquals("Invalid number of working copies kept between tests!", 2, workingCopies.length);
4159
	IType type = workingCopies[1].getType("Sub");
4194
	IType type = workingCopies[1].getType("Sub");
4160
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4195
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4161
	search(method, UI_DECLARATIONS);
4196
	search(method, UI_DECLARATIONS);
Lines 4163-4169 Link Here
4163
		"src/b100772/Sub.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
4198
		"src/b100772/Sub.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
4164
	);
4199
	);
4165
}
4200
}
4166
public void testBug100772_ProjectScope_InterfacesAndClass01() throws CoreException {
4201
private void setUpBug100772_ProjectScope_InterfacesAndClass() throws CoreException {
4167
	workingCopies = new ICompilationUnit[3];
4202
	workingCopies = new ICompilationUnit[3];
4168
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4203
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4169
		"package b100772;\n" + 
4204
		"package b100772;\n" + 
Lines 4187-4196 Link Here
4187
		"    public void foo(Exception e) {}\n" + 
4222
		"    public void foo(Exception e) {}\n" + 
4188
		"}\n"
4223
		"}\n"
4189
	);
4224
	);
4225
}
4226
public void testBug100772_ProjectScope_InterfacesAndClass01() throws CoreException {
4227
	setUpBug100772_ProjectScope_InterfacesAndClass();
4190
	IType type = workingCopies[0].getType("Test");
4228
	IType type = workingCopies[0].getType("Test");
4191
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4229
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4192
	search(method, UI_DECLARATIONS);
4230
	search(method, UI_DECLARATIONS);
4193
	this.discard = false;
4194
	assertSearchResults(
4231
	assertSearchResults(
4195
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4232
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4196
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4233
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 4198-4209 Link Here
4198
	);
4235
	);
4199
}
4236
}
4200
public void testBug100772_ProjectScope_InterfacesAndClass02() throws CoreException {
4237
public void testBug100772_ProjectScope_InterfacesAndClass02() throws CoreException {
4201
	assertNotNull("There should be working copies!", workingCopies);
4238
	setUpBug100772_ProjectScope_InterfacesAndClass();
4202
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4203
	IType type = workingCopies[0].getType("Test");
4239
	IType type = workingCopies[0].getType("Test");
4204
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4240
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4205
	search(method, DECLARATIONS);
4241
	search(method, DECLARATIONS);
4206
	this.discard = false;
4207
	assertSearchResults(
4242
	assertSearchResults(
4208
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4243
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4209
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4244
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 4211-4234 Link Here
4211
	);
4246
	);
4212
}
4247
}
4213
public void testBug100772_ProjectScope_InterfacesAndClass03() throws CoreException {
4248
public void testBug100772_ProjectScope_InterfacesAndClass03() throws CoreException {
4214
	assertNotNull("There should be working copies!", workingCopies);
4249
	setUpBug100772_ProjectScope_InterfacesAndClass();
4215
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4216
	IType type = workingCopies[0].getType("Test");
4250
	IType type = workingCopies[0].getType("Test");
4217
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4251
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4218
	search(method, UI_DECLARATIONS);
4252
	search(method, UI_DECLARATIONS);
4219
	this.discard = false;
4220
	assertSearchResults(
4253
	assertSearchResults(
4221
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4254
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4222
		"src/b100772/X.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4255
		"src/b100772/X.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4223
	);
4256
	);
4224
}
4257
}
4225
public void testBug100772_ProjectScope_InterfacesAndClass04() throws CoreException {
4258
public void testBug100772_ProjectScope_InterfacesAndClass04() throws CoreException {
4226
	assertNotNull("There should be working copies!", workingCopies);
4259
	setUpBug100772_ProjectScope_InterfacesAndClass();
4227
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4228
	IType type = workingCopies[1].getType("Sub");
4260
	IType type = workingCopies[1].getType("Sub");
4229
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4261
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4230
	search(method, UI_DECLARATIONS);
4262
	search(method, UI_DECLARATIONS);
4231
	this.discard = false;
4232
	assertSearchResults(
4263
	assertSearchResults(
4233
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4264
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4234
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4265
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 4236-4259 Link Here
4236
	);
4267
	);
4237
}
4268
}
4238
public void testBug100772_ProjectScope_InterfacesAndClass05() throws CoreException {
4269
public void testBug100772_ProjectScope_InterfacesAndClass05() throws CoreException {
4239
	assertNotNull("There should be working copies!", workingCopies);
4270
	setUpBug100772_ProjectScope_InterfacesAndClass();
4240
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4241
	IType type = workingCopies[1].getType("Sub");
4271
	IType type = workingCopies[1].getType("Sub");
4242
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4272
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4243
	search(method, UI_DECLARATIONS);
4273
	search(method, UI_DECLARATIONS);
4244
	this.discard = false;
4245
	assertSearchResults(
4274
	assertSearchResults(
4246
		"src/b100772/Sub.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH\n" + 
4275
		"src/b100772/Sub.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH\n" + 
4247
		"src/b100772/X.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4276
		"src/b100772/X.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4248
	);
4277
	);
4249
}
4278
}
4250
public void testBug100772_ProjectScope_InterfacesAndClass06() throws CoreException {
4279
public void testBug100772_ProjectScope_InterfacesAndClass06() throws CoreException {
4251
	assertNotNull("There should be working copies!", workingCopies);
4280
	setUpBug100772_ProjectScope_InterfacesAndClass();
4252
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4253
	IType type = workingCopies[2].getType("X");
4281
	IType type = workingCopies[2].getType("X");
4254
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4282
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4255
	search(method, UI_DECLARATIONS);
4283
	search(method, UI_DECLARATIONS);
4256
	this.discard = false;
4257
	assertSearchResults(
4284
	assertSearchResults(
4258
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4285
		"src/b100772/Sub.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4259
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4286
		"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 4261-4280 Link Here
4261
	);
4288
	);
4262
}
4289
}
4263
public void testBug100772_ProjectScope_InterfacesAndClass07() throws CoreException {
4290
public void testBug100772_ProjectScope_InterfacesAndClass07() throws CoreException {
4264
	assertNotNull("There should be working copies!", workingCopies);
4291
	setUpBug100772_ProjectScope_InterfacesAndClass();
4265
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4266
	IType type = workingCopies[2].getType("X");
4292
	IType type = workingCopies[2].getType("X");
4267
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4293
	IMethod method = type.getMethod("foo", new String[] { "QClass;" });
4268
	search(method, UI_DECLARATIONS);
4294
	search(method, UI_DECLARATIONS);
4269
	this.discard = false;
4270
	assertSearchResults(
4295
	assertSearchResults(
4271
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4296
		"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4272
		"src/b100772/X.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4297
		"src/b100772/X.java void b100772.X.foo(Class) [foo] EXACT_MATCH"
4273
	);
4298
	);
4274
}
4299
}
4275
public void testBug100772_ProjectScope_InterfacesAndClass08() throws CoreException {
4300
public void testBug100772_ProjectScope_InterfacesAndClass08() throws CoreException {
4276
	assertNotNull("There should be working copies!", workingCopies);
4301
	setUpBug100772_ProjectScope_InterfacesAndClass();
4277
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4278
	IType type = workingCopies[2].getType("X");
4302
	IType type = workingCopies[2].getType("X");
4279
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4303
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4280
	search(method, UI_DECLARATIONS);
4304
	search(method, UI_DECLARATIONS);
Lines 4283-4289 Link Here
4283
		"src/b100772/X.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4307
		"src/b100772/X.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4284
	);
4308
	);
4285
}
4309
}
4286
public void testBug100772_ProjectScope_Complex01() throws CoreException {
4310
private void setUpBug100772_ProjectScope_Complex() throws CoreException {
4287
	workingCopies = new ICompilationUnit[6];
4311
	workingCopies = new ICompilationUnit[6];
4288
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/X.java",
4312
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/X.java",
4289
		"package b100772;\n" + 
4313
		"package b100772;\n" + 
Lines 4324-4333 Link Here
4324
		"	public void foo(Exception e) {}\n" + 
4348
		"	public void foo(Exception e) {}\n" + 
4325
		"}\n"
4349
		"}\n"
4326
	);
4350
	);
4351
}
4352
public void testBug100772_ProjectScope_Complex01() throws CoreException {
4353
	setUpBug100772_ProjectScope_Complex();
4327
	IType type = workingCopies[2].getType("IX");
4354
	IType type = workingCopies[2].getType("IX");
4328
	IMethod method = type.getMethod("foo", new String[] { "QU;" });
4355
	IMethod method = type.getMethod("foo", new String[] { "QU;" });
4329
	search(method, DECLARATIONS);
4356
	search(method, DECLARATIONS);
4330
	this.discard = false;
4331
	assertSearchResults(
4357
	assertSearchResults(
4332
		"src/b100772/IX.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4358
		"src/b100772/IX.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4333
		"src/b100772/X.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
4359
		"src/b100772/X.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
Lines 4337-4348 Link Here
4337
	);
4363
	);
4338
}
4364
}
4339
public void testBug100772_ProjectScope_Complex02() throws CoreException {
4365
public void testBug100772_ProjectScope_Complex02() throws CoreException {
4340
	assertNotNull("There should be working copies!", workingCopies);
4366
	setUpBug100772_ProjectScope_Complex();
4341
	assertEquals("Invalid number of working copies kept between tests!", 6, workingCopies.length);
4342
	IType type = workingCopies[5].getType("Z");
4367
	IType type = workingCopies[5].getType("Z");
4343
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4368
	IMethod method = type.getMethod("foo", new String[] { "QString;" });
4344
	search(method, UI_DECLARATIONS);
4369
	search(method, UI_DECLARATIONS);
4345
	this.discard = false;
4346
	assertSearchResults(
4370
	assertSearchResults(
4347
		"src/b100772/IX.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4371
		"src/b100772/IX.java void b100772.IX.foo(U) [foo] EXACT_MATCH\n" + 
4348
		"src/b100772/XX.java void b100772.XX.foo(String) [foo] EXACT_MATCH\n" + 
4372
		"src/b100772/XX.java void b100772.XX.foo(String) [foo] EXACT_MATCH\n" + 
Lines 4351-4362 Link Here
4351
	);
4375
	);
4352
}
4376
}
4353
public void testBug100772_ProjectScope_Complex03() throws CoreException {
4377
public void testBug100772_ProjectScope_Complex03() throws CoreException {
4354
	assertNotNull("There should be working copies!", workingCopies);
4378
	setUpBug100772_ProjectScope_Complex();
4355
	assertEquals("Invalid number of working copies kept between tests!", 6, workingCopies.length);
4356
	IType type = workingCopies[5].getType("Z");
4379
	IType type = workingCopies[5].getType("Z");
4357
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4380
	IMethod method = type.getMethod("foo", new String[] { "QException;" });
4358
	search(method, UI_DECLARATIONS);
4381
	search(method, UI_DECLARATIONS);
4359
	this.discard = false;
4360
	assertSearchResults(
4382
	assertSearchResults(
4361
		"src/b100772/IXX.java void b100772.IXX.foo(V) [foo] EXACT_MATCH\n" + 
4383
		"src/b100772/IXX.java void b100772.IXX.foo(V) [foo] EXACT_MATCH\n" + 
4362
		"src/b100772/XX.java void b100772.XX.foo(Exception) [foo] EXACT_MATCH\n" + 
4384
		"src/b100772/XX.java void b100772.XX.foo(Exception) [foo] EXACT_MATCH\n" + 
Lines 4365-4372 Link Here
4365
	);
4387
	);
4366
}
4388
}
4367
public void testBug100772_ProjectScope_Complex04() throws CoreException {
4389
public void testBug100772_ProjectScope_Complex04() throws CoreException {
4368
	assertNotNull("There should be working copies!", workingCopies);
4390
	setUpBug100772_ProjectScope_Complex();
4369
	assertEquals("Invalid number of working copies kept between tests!", 6, workingCopies.length);
4370
	IType type = workingCopies[0].getType("X");
4391
	IType type = workingCopies[0].getType("X");
4371
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4392
	IMethod method = type.getMethod("foo", new String[] { "QT;" });
4372
	search(method, UI_DECLARATIONS);
4393
	search(method, UI_DECLARATIONS);
Lines 4401-4407 Link Here
4401
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=110060"
4422
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=110060"
4402
 */
4423
 */
4403
// Types search
4424
// Types search
4404
public void testBug110060_TypePattern01() throws CoreException {
4425
private void setUpBug110060_TypePattern() throws CoreException {
4405
	workingCopies = new ICompilationUnit[5];
4426
	workingCopies = new ICompilationUnit[5];
4406
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
4427
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
4407
		"package b110060;\n" + 
4428
		"package b110060;\n" + 
Lines 4432-4439 Link Here
4432
		"	AxxAyy axxayy;\n" + 
4453
		"	AxxAyy axxayy;\n" + 
4433
		"}\n"
4454
		"}\n"
4434
	);
4455
	);
4456
}
4457
public void testBug110060_TypePattern01() throws CoreException {
4458
	setUpBug110060_TypePattern();
4435
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4459
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4436
	this.discard = false;
4437
	assertSearchResults(
4460
	assertSearchResults(
4438
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + 
4461
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + 
4439
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + 
4462
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + 
Lines 4443-4452 Link Here
4443
}
4466
}
4444
4467
4445
public void testBug110060_TypePattern02() throws CoreException {
4468
public void testBug110060_TypePattern02() throws CoreException {
4446
	assertNotNull("There should be working copies!", workingCopies);
4469
	setUpBug110060_TypePattern();
4447
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4448
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4470
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4449
	this.discard = false;
4450
	assertSearchResults(
4471
	assertSearchResults(
4451
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4472
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4452
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4473
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
Lines 4460-4469 Link Here
4460
}
4481
}
4461
4482
4462
public void testBug110060_TypePattern03() throws CoreException {
4483
public void testBug110060_TypePattern03() throws CoreException {
4463
	assertNotNull("There should be working copies!", workingCopies);
4484
	setUpBug110060_TypePattern();
4464
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4465
	search("AAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4485
	search("AAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4466
	this.discard = false;
4467
	assertSearchResults(
4486
	assertSearchResults(
4468
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4487
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4469
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH"
4488
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH"
Lines 4471-4480 Link Here
4471
}
4490
}
4472
4491
4473
public void testBug110060_TypePattern04() throws CoreException {
4492
public void testBug110060_TypePattern04() throws CoreException {
4474
	assertNotNull("There should be working copies!", workingCopies);
4493
	setUpBug110060_TypePattern();
4475
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4476
	search("Axx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4494
	search("Axx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4477
	this.discard = false;
4478
	assertSearchResults(
4495
	assertSearchResults(
4479
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4496
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4480
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4497
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
Lines 4482-4491 Link Here
4482
}
4499
}
4483
4500
4484
public void testBug110060_TypePattern05() throws CoreException {
4501
public void testBug110060_TypePattern05() throws CoreException {
4485
	assertNotNull("There should be working copies!", workingCopies);
4502
	setUpBug110060_TypePattern();
4486
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4487
	search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4503
	search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4488
	this.discard = false;
4489
	assertSearchResults(
4504
	assertSearchResults(
4490
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + 
4505
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + 
4491
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4506
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
Lines 4495-4504 Link Here
4495
}
4510
}
4496
4511
4497
public void testBug110060_TypePattern06() throws CoreException {
4512
public void testBug110060_TypePattern06() throws CoreException {
4498
	assertNotNull("There should be working copies!", workingCopies);
4513
	setUpBug110060_TypePattern();
4499
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4500
	search("A*A*", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4514
	search("A*A*", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4501
	this.discard = false;
4502
	assertSearchResults(
4515
	assertSearchResults(
4503
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4516
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4504
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4517
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
Lines 4513-4530 Link Here
4513
}
4526
}
4514
4527
4515
public void testBug110060_TypePattern07() throws CoreException {
4528
public void testBug110060_TypePattern07() throws CoreException {
4516
	assertNotNull("There should be working copies!", workingCopies);
4529
	setUpBug110060_TypePattern();
4517
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4518
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4530
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4519
	this.discard = false;
4520
	assertSearchResults("");
4531
	assertSearchResults("");
4521
}
4532
}
4522
4533
4523
public void testBug110060_TypePattern08() throws CoreException {
4534
public void testBug110060_TypePattern08() throws CoreException {
4524
	assertNotNull("There should be working copies!", workingCopies);
4535
	setUpBug110060_TypePattern();
4525
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4526
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH);
4536
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH);
4527
	this.discard = false;
4528
	assertSearchResults(
4537
	assertSearchResults(
4529
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4538
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4530
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4539
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
Lines 4534-4543 Link Here
4534
}
4543
}
4535
4544
4536
public void testBug110060_TypePattern09() throws CoreException {
4545
public void testBug110060_TypePattern09() throws CoreException {
4537
	assertNotNull("There should be working copies!", workingCopies);
4546
	setUpBug110060_TypePattern();
4538
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4539
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
4547
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
4540
	this.discard = false;
4541
	assertSearchResults(
4548
	assertSearchResults(
4542
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4549
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + 
4543
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4550
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
Lines 4551-4568 Link Here
4551
}
4558
}
4552
4559
4553
public void testBug110060_TypePattern10() throws CoreException {
4560
public void testBug110060_TypePattern10() throws CoreException {
4554
	assertNotNull("There should be working copies!", workingCopies);
4561
	setUpBug110060_TypePattern();
4555
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4556
	search("AxAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4562
	search("AxAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4557
	this.discard = false;
4558
	assertSearchResults("");
4563
	assertSearchResults("");
4559
}
4564
}
4560
4565
4561
public void testBug110060_TypePattern11() throws CoreException {
4566
public void testBug110060_TypePattern11() throws CoreException {
4562
	assertNotNull("There should be working copies!", workingCopies);
4567
	setUpBug110060_TypePattern();
4563
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4564
	search("AxxA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4568
	search("AxxA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4565
	this.discard = false;
4566
	assertSearchResults(
4569
	assertSearchResults(
4567
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4570
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4568
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4571
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
Lines 4570-4579 Link Here
4570
}
4573
}
4571
4574
4572
public void testBug110060_TypePattern12() throws CoreException {
4575
public void testBug110060_TypePattern12() throws CoreException {
4573
	assertNotNull("There should be working copies!", workingCopies);
4576
	setUpBug110060_TypePattern();
4574
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4575
	search("AxXA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4577
	search("AxXA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4576
	this.discard = false;
4577
	assertSearchResults(
4578
	assertSearchResults(
4578
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4579
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + 
4579
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4580
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
Lines 4581-4588 Link Here
4581
}
4582
}
4582
4583
4583
public void testBug110060_AllTypeNames01() throws CoreException {
4584
public void testBug110060_AllTypeNames01() throws CoreException {
4584
	assertNotNull("There should be working copies!", workingCopies);
4585
	setUpBug110060_TypePattern();
4585
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4586
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4586
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4587
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4587
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4588
		null,
4588
		null,
Lines 4594-4600 Link Here
4594
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4594
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4595
		null
4595
		null
4596
	);
4596
	);
4597
	this.discard = false;
4598
	assertSearchResults(
4597
	assertSearchResults(
4599
		"Unexpected all type names",
4598
		"Unexpected all type names",
4600
		"b110060.AA\n" + 
4599
		"b110060.AA\n" + 
Lines 4605-4612 Link Here
4605
}
4604
}
4606
4605
4607
public void testBug110060_AllTypeNames02() throws CoreException {
4606
public void testBug110060_AllTypeNames02() throws CoreException {
4608
	assertNotNull("There should be working copies!", workingCopies);
4607
	setUpBug110060_TypePattern();
4609
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4610
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4608
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4611
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4609
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4612
		null,
4610
		null,
Lines 4618-4624 Link Here
4618
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4616
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4619
		null
4617
		null
4620
	);
4618
	);
4621
	this.discard = false;
4622
	assertSearchResults(
4619
	assertSearchResults(
4623
		"Unexpected all type names",
4620
		"Unexpected all type names",
4624
		"b110060.AA\n" + 
4621
		"b110060.AA\n" + 
Lines 4629-4636 Link Here
4629
}
4626
}
4630
4627
4631
public void testBug110060_AllTypeNames03() throws CoreException {
4628
public void testBug110060_AllTypeNames03() throws CoreException {
4632
	assertNotNull("There should be working copies!", workingCopies);
4629
	setUpBug110060_TypePattern();
4633
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4634
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4630
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4635
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4631
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4636
		null,
4632
		null,
Lines 4642-4648 Link Here
4642
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4638
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4643
		null
4639
		null
4644
	);
4640
	);
4645
	this.discard = false;
4646
	assertSearchResults(
4641
	assertSearchResults(
4647
		"Unexpected all type names",
4642
		"Unexpected all type names",
4648
		"b110060.AA\n" + 
4643
		"b110060.AA\n" + 
Lines 4653-4660 Link Here
4653
}
4648
}
4654
4649
4655
public void testBug110060_AllTypeNames04() throws CoreException {
4650
public void testBug110060_AllTypeNames04() throws CoreException {
4656
	assertNotNull("There should be working copies!", workingCopies);
4651
	setUpBug110060_TypePattern();
4657
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4658
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4652
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4659
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4653
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4660
		null,
4654
		null,
Lines 4666-4672 Link Here
4666
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4660
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4667
		null
4661
		null
4668
	);
4662
	);
4669
	this.discard = false;
4670
	assertSearchResults(
4663
	assertSearchResults(
4671
		"Unexpected all type names",
4664
		"Unexpected all type names",
4672
		"b110060.AA\n" + 
4665
		"b110060.AA\n" + 
Lines 4677-4684 Link Here
4677
}
4670
}
4678
4671
4679
public void testBug110060_AllTypeNames05() throws CoreException {
4672
public void testBug110060_AllTypeNames05() throws CoreException {
4680
	assertNotNull("There should be working copies!", workingCopies);
4673
	setUpBug110060_TypePattern();
4681
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4682
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4674
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4683
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4675
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4684
		null,
4676
		null,
Lines 4690-4696 Link Here
4690
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4682
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4691
		null
4683
		null
4692
	);
4684
	);
4693
	this.discard = false;
4694
	assertSearchResults(
4685
	assertSearchResults(
4695
		"Unexpected all type names",
4686
		"Unexpected all type names",
4696
		"b110060.AA\n" + 
4687
		"b110060.AA\n" + 
Lines 4699-4706 Link Here
4699
}
4690
}
4700
4691
4701
public void testBug110060_AllTypeNames06() throws CoreException {
4692
public void testBug110060_AllTypeNames06() throws CoreException {
4702
	assertNotNull("There should be working copies!", workingCopies);
4693
	setUpBug110060_TypePattern();
4703
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4704
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4694
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4705
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4695
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4706
		null,
4696
		null,
Lines 4712-4718 Link Here
4712
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4702
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4713
		null
4703
		null
4714
	);
4704
	);
4715
	this.discard = false;
4716
	assertSearchResults(
4705
	assertSearchResults(
4717
		"Unexpected all type names",
4706
		"Unexpected all type names",
4718
		"b110060.AA",
4707
		"b110060.AA",
Lines 4720-4727 Link Here
4720
}
4709
}
4721
4710
4722
public void testBug110060_AllTypeNames07() throws CoreException {
4711
public void testBug110060_AllTypeNames07() throws CoreException {
4723
	assertNotNull("There should be working copies!", workingCopies);
4712
	setUpBug110060_TypePattern();
4724
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4725
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4713
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4726
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4714
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4727
		null,
4715
		null,
Lines 4733-4739 Link Here
4733
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4721
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4734
		null
4722
		null
4735
	);
4723
	);
4736
	this.discard = false;
4737
	assertSearchResults(
4724
	assertSearchResults(
4738
		"Unexpected all type names",
4725
		"Unexpected all type names",
4739
		"b110060.AA\n" + 
4726
		"b110060.AA\n" + 
Lines 4742-4749 Link Here
4742
}
4729
}
4743
4730
4744
public void testBug110060_AllTypeNames08() throws CoreException {
4731
public void testBug110060_AllTypeNames08() throws CoreException {
4745
	assertNotNull("There should be working copies!", workingCopies);
4732
	setUpBug110060_TypePattern();
4746
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4747
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4733
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4748
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4734
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4749
		null,
4735
		null,
Lines 4755-4761 Link Here
4755
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4741
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4756
		null
4742
		null
4757
	);
4743
	);
4758
	this.discard = false;
4759
	assertSearchResults(
4744
	assertSearchResults(
4760
		"Unexpected all type names",
4745
		"Unexpected all type names",
4761
		"b110060.AA\n" + 
4746
		"b110060.AA\n" + 
Lines 4764-4771 Link Here
4764
}
4749
}
4765
4750
4766
public void testBug110060_AllTypeNames09() throws CoreException {
4751
public void testBug110060_AllTypeNames09() throws CoreException {
4767
	assertNotNull("There should be working copies!", workingCopies);
4752
	setUpBug110060_TypePattern();
4768
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4769
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4753
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4770
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4754
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4771
		null,
4755
		null,
Lines 4777-4783 Link Here
4777
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4761
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4778
		null
4762
		null
4779
	);
4763
	);
4780
	this.discard = false;
4781
	assertSearchResults(
4764
	assertSearchResults(
4782
		"Unexpected all type names",
4765
		"Unexpected all type names",
4783
		"b110060.AA\n" + 
4766
		"b110060.AA\n" + 
Lines 4786-4793 Link Here
4786
}
4769
}
4787
4770
4788
public void testBug110060_AllTypeNames10() throws CoreException {
4771
public void testBug110060_AllTypeNames10() throws CoreException {
4789
	assertNotNull("There should be working copies!", workingCopies);
4772
	setUpBug110060_TypePattern();
4790
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4791
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4773
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4792
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4774
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4793
		null,
4775
		null,
Lines 4799-4805 Link Here
4799
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4781
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4800
		null
4782
		null
4801
	);
4783
	);
4802
	this.discard = false;
4803
	assertSearchResults(
4784
	assertSearchResults(
4804
		"Unexpected all type names",
4785
		"Unexpected all type names",
4805
		"",
4786
		"",
Lines 4807-4814 Link Here
4807
}
4788
}
4808
4789
4809
public void testBug110060_AllTypeNames11() throws CoreException {
4790
public void testBug110060_AllTypeNames11() throws CoreException {
4810
	assertNotNull("There should be working copies!", workingCopies);
4791
	setUpBug110060_TypePattern();
4811
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4812
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4792
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4813
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4793
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4814
		null,
4794
		null,
Lines 4820-4826 Link Here
4820
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4800
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4821
		null
4801
		null
4822
	);
4802
	);
4823
	this.discard = false;
4824
	assertSearchResults(
4803
	assertSearchResults(
4825
		"Unexpected all type names",
4804
		"Unexpected all type names",
4826
		"",
4805
		"",
Lines 4828-4835 Link Here
4828
}
4807
}
4829
4808
4830
public void testBug110060_AllTypeNames12() throws CoreException {
4809
public void testBug110060_AllTypeNames12() throws CoreException {
4831
	assertNotNull("There should be working copies!", workingCopies);
4810
	setUpBug110060_TypePattern();
4832
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4833
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4811
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4834
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4812
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4835
		null,
4813
		null,
Lines 4841-4847 Link Here
4841
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4819
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4842
		null
4820
		null
4843
	);
4821
	);
4844
	this.discard = false;
4845
	assertSearchResults(
4822
	assertSearchResults(
4846
		"Unexpected all type names",
4823
		"Unexpected all type names",
4847
		"b110060.AA\n" + 
4824
		"b110060.AA\n" + 
Lines 4850-4857 Link Here
4850
}
4827
}
4851
4828
4852
public void testBug110060_AllTypeNames13() throws CoreException {
4829
public void testBug110060_AllTypeNames13() throws CoreException {
4853
	assertNotNull("There should be working copies!", workingCopies);
4830
	setUpBug110060_TypePattern();
4854
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4855
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4831
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4856
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4832
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4857
		null,
4833
		null,
Lines 4863-4869 Link Here
4863
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4839
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4864
		null
4840
		null
4865
	);
4841
	);
4866
	this.discard = false;
4867
	assertSearchResults(
4842
	assertSearchResults(
4868
		"Unexpected all type names",
4843
		"Unexpected all type names",
4869
		"",
4844
		"",
Lines 4871-4878 Link Here
4871
}
4846
}
4872
4847
4873
public void testBug110060_AllTypeNames14() throws CoreException {
4848
public void testBug110060_AllTypeNames14() throws CoreException {
4874
	assertNotNull("There should be working copies!", workingCopies);
4849
	setUpBug110060_TypePattern();
4875
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4876
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4850
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4877
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4851
	new SearchEngine(this.workingCopies).searchAllTypeNames(
4878
		null,
4852
		null,
Lines 4884-4890 Link Here
4884
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4858
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
4885
		null
4859
		null
4886
	);
4860
	);
4887
	this.discard = false;
4888
	assertSearchResults(
4861
	assertSearchResults(
4889
		"Unexpected all type names",
4862
		"Unexpected all type names",
4890
		"",
4863
		"",
Lines 4892-4898 Link Here
4892
}
4865
}
4893
4866
4894
// Constructor search
4867
// Constructor search
4895
public void testBug110060_ConstructorPattern01() throws CoreException {
4868
private void setUpBug110060_ConstructorPattern() throws CoreException {
4896
	workingCopies = new ICompilationUnit[5];
4869
	workingCopies = new ICompilationUnit[5];
4897
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
4870
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
4898
		"package b110060;\n" + 
4871
		"package b110060;\n" + 
Lines 4927-4934 Link Here
4927
		"	AxxAyy axxayy = new AxxAyy();\n" + 
4900
		"	AxxAyy axxayy = new AxxAyy();\n" + 
4928
		"}\n"
4901
		"}\n"
4929
	);
4902
	);
4903
}
4904
public void testBug110060_ConstructorPattern01() throws CoreException {
4905
	setUpBug110060_ConstructorPattern();
4930
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4906
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4931
	this.discard = false;
4932
	assertSearchResults(
4907
	assertSearchResults(
4933
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" + 
4908
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" + 
4934
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" + 
4909
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" + 
Lines 4938-4947 Link Here
4938
}
4913
}
4939
4914
4940
public void testBug110060_ConstructorPattern02() throws CoreException {
4915
public void testBug110060_ConstructorPattern02() throws CoreException {
4941
	assertNotNull("There should be working copies!", workingCopies);
4916
	setUpBug110060_ConstructorPattern();
4942
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4943
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4917
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4944
	this.discard = false;
4945
	assertSearchResults(
4918
	assertSearchResults(
4946
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + 
4919
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + 
4947
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + 
4920
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + 
Lines 4955-4964 Link Here
4955
}
4928
}
4956
4929
4957
public void testBug110060_ConstructorPattern03() throws CoreException {
4930
public void testBug110060_ConstructorPattern03() throws CoreException {
4958
	assertNotNull("There should be working copies!", workingCopies);
4931
	setUpBug110060_ConstructorPattern();
4959
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4960
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4932
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4961
	this.discard = false;
4962
	assertSearchResults(
4933
	assertSearchResults(
4963
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + 
4934
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + 
4964
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH"
4935
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH"
Lines 4966-4975 Link Here
4966
}
4937
}
4967
4938
4968
public void testBug110060_ConstructorPattern04() throws CoreException {
4939
public void testBug110060_ConstructorPattern04() throws CoreException {
4969
	assertNotNull("There should be working copies!", workingCopies);
4940
	setUpBug110060_ConstructorPattern();
4970
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4971
	search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4941
	search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4972
	this.discard = false;
4973
	assertSearchResults(
4942
	assertSearchResults(
4974
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
4943
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
4975
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
4944
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
Lines 4977-4986 Link Here
4977
}
4946
}
4978
4947
4979
public void testBug110060_ConstructorPattern05() throws CoreException {
4948
public void testBug110060_ConstructorPattern05() throws CoreException {
4980
	assertNotNull("There should be working copies!", workingCopies);
4949
	setUpBug110060_ConstructorPattern();
4981
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4982
	search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4950
	search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4983
	this.discard = false;
4984
	assertSearchResults(
4951
	assertSearchResults(
4985
		"src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" + 
4952
		"src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" + 
4986
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
4953
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
Lines 4990-4997 Link Here
4990
}
4957
}
4991
4958
4992
public void testBug110060_ConstructorPattern06() throws CoreException {
4959
public void testBug110060_ConstructorPattern06() throws CoreException {
4993
	assertNotNull("There should be working copies!", workingCopies);
4960
	setUpBug110060_ConstructorPattern();
4994
	assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length);
4995
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4961
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4996
	assertSearchResults(
4962
	assertSearchResults(
4997
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + 
4963
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + 
Lines 5006-5012 Link Here
5006
}
4972
}
5007
4973
5008
// Methods search
4974
// Methods search
5009
public void testBug110060_MethodPattern01() throws CoreException {
4975
private void setUpBug110060_MethodPattern() throws CoreException {
5010
	workingCopies = new ICompilationUnit[1];
4976
	workingCopies = new ICompilationUnit[1];
5011
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
4977
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
5012
		"package b110060;\n" + 
4978
		"package b110060;\n" + 
Lines 5025-5048 Link Here
5025
		"	}\n" + 
4991
		"	}\n" + 
5026
		"}\n"
4992
		"}\n"
5027
	);
4993
	);
4994
}
4995
public void testBug110060_MethodPattern01() throws CoreException {
4996
	setUpBug110060_MethodPattern();
5028
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4997
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5029
	this.discard = false;
5030
	assertSearchResults("");
4998
	assertSearchResults("");
5031
}
4999
}
5032
5000
5033
public void testBug110060_MethodPattern02() throws CoreException {
5001
public void testBug110060_MethodPattern02() throws CoreException {
5034
	assertNotNull("There should be working copies!", workingCopies);
5002
	setUpBug110060_MethodPattern();
5035
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5036
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5003
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5037
	this.discard = false;
5038
	assertSearchResults("");
5004
	assertSearchResults("");
5039
}
5005
}
5040
5006
5041
public void testBug110060_MethodPattern03() throws CoreException {
5007
public void testBug110060_MethodPattern03() throws CoreException {
5042
	assertNotNull("There should be working copies!", workingCopies);
5008
	setUpBug110060_MethodPattern();
5043
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5044
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5009
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5045
	this.discard = false;
5046
	assertSearchResults(
5010
	assertSearchResults(
5047
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5011
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5048
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
5012
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
Lines 5052-5061 Link Here
5052
}
5016
}
5053
5017
5054
public void testBug110060_MethodPattern04() throws CoreException {
5018
public void testBug110060_MethodPattern04() throws CoreException {
5055
	assertNotNull("There should be working copies!", workingCopies);
5019
	setUpBug110060_MethodPattern();
5056
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5057
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5020
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5058
	this.discard = false;
5059
	assertSearchResults(
5021
	assertSearchResults(
5060
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5022
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5061
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5023
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
Lines 5069-5078 Link Here
5069
}
5031
}
5070
5032
5071
public void testBug110060_MethodPattern05() throws CoreException {
5033
public void testBug110060_MethodPattern05() throws CoreException {
5072
	assertNotNull("There should be working copies!", workingCopies);
5034
	setUpBug110060_MethodPattern();
5073
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5074
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5035
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5075
	this.discard = false;
5076
	assertSearchResults(
5036
	assertSearchResults(
5077
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5037
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5078
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5038
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
Lines 5086-5095 Link Here
5086
}
5046
}
5087
5047
5088
public void testBug110060_MethodPattern06() throws CoreException {
5048
public void testBug110060_MethodPattern06() throws CoreException {
5089
	assertNotNull("There should be working copies!", workingCopies);
5049
	setUpBug110060_MethodPattern();
5090
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5091
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5050
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5092
	this.discard = false;
5093
	assertSearchResults(
5051
	assertSearchResults(
5094
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5052
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5095
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
5053
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
Lines 5101-5110 Link Here
5101
}
5059
}
5102
5060
5103
public void testBug110060_MethodPattern07() throws CoreException {
5061
public void testBug110060_MethodPattern07() throws CoreException {
5104
	assertNotNull("There should be working copies!", workingCopies);
5062
	setUpBug110060_MethodPattern();
5105
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5106
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5063
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5107
	this.discard = false;
5108
	assertSearchResults(
5064
	assertSearchResults(
5109
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5065
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + 
5110
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
5066
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + 
Lines 5118-5133 Link Here
5118
}
5074
}
5119
5075
5120
public void testBug110060_MethodPattern08() throws CoreException {
5076
public void testBug110060_MethodPattern08() throws CoreException {
5121
	assertNotNull("There should be working copies!", workingCopies);
5077
	setUpBug110060_MethodPattern();
5122
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5123
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5078
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5124
	this.discard = false;
5125
	assertSearchResults("");
5079
	assertSearchResults("");
5126
}
5080
}
5127
5081
5128
public void testBug110060_MethodPattern09() throws CoreException {
5082
public void testBug110060_MethodPattern09() throws CoreException {
5129
	assertNotNull("There should be working copies!", workingCopies);
5083
	setUpBug110060_MethodPattern();
5130
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5131
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5084
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5132
	assertSearchResults(
5085
	assertSearchResults(
5133
		"src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" + 
5086
		"src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" + 
Lines 5136-5142 Link Here
5136
}
5089
}
5137
5090
5138
// Fields search
5091
// Fields search
5139
public void testBug110060_FieldPattern01() throws CoreException {
5092
private void setUpBug110060_FieldPattern() throws CoreException {
5140
	workingCopies = new ICompilationUnit[1];
5093
	workingCopies = new ICompilationUnit[1];
5141
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
5094
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
5142
		"package b110060;\n" + 
5095
		"package b110060;\n" + 
Lines 5155-5162 Link Here
5155
		"	Object oF = otherFieldWhichStartsWithAnotherLetter;\n" + 
5108
		"	Object oF = otherFieldWhichStartsWithAnotherLetter;\n" + 
5156
		"}\n"
5109
		"}\n"
5157
	);
5110
	);
5111
}
5112
public void testBug110060_FieldPattern01() throws CoreException {
5113
	setUpBug110060_FieldPattern();
5158
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5114
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5159
	this.discard = false;
5160
	assertSearchResults(
5115
	assertSearchResults(
5161
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5116
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5162
		"src/b110060/Test.java b110060.Test.aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH\n" + 
5117
		"src/b110060/Test.java b110060.Test.aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH\n" + 
Lines 5166-5183 Link Here
5166
}
5121
}
5167
5122
5168
public void testBug110060_FieldPattern02() throws CoreException {
5123
public void testBug110060_FieldPattern02() throws CoreException {
5169
	assertNotNull("There should be working copies!", workingCopies);
5124
	setUpBug110060_FieldPattern();
5170
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5171
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5125
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5172
	this.discard = false;
5173
	assertSearchResults("");
5126
	assertSearchResults("");
5174
}
5127
}
5175
5128
5176
public void testBug110060_FieldPattern03() throws CoreException {
5129
public void testBug110060_FieldPattern03() throws CoreException {
5177
	assertNotNull("There should be working copies!", workingCopies);
5130
	setUpBug110060_FieldPattern();
5178
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5179
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5131
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5180
	this.discard = false;
5181
	assertSearchResults(
5132
	assertSearchResults(
5182
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5133
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5183
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5134
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
Lines 5185-5194 Link Here
5185
}
5136
}
5186
5137
5187
public void testBug110060_FieldPattern04() throws CoreException {
5138
public void testBug110060_FieldPattern04() throws CoreException {
5188
	assertNotNull("There should be working copies!", workingCopies);
5139
	setUpBug110060_FieldPattern();
5189
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5190
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5140
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5191
	this.discard = false;
5192
	assertSearchResults(
5141
	assertSearchResults(
5193
		"src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" + 
5142
		"src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" + 
5194
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5143
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
Lines 5196-5205 Link Here
5196
}
5145
}
5197
5146
5198
public void testBug110060_FieldPattern05() throws CoreException {
5147
public void testBug110060_FieldPattern05() throws CoreException {
5199
	assertNotNull("There should be working copies!", workingCopies);
5148
	setUpBug110060_FieldPattern();
5200
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5201
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5149
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5202
	this.discard = false;
5203
	assertSearchResults(
5150
	assertSearchResults(
5204
		"src/b110060/Test.java b110060.Test.otherFieldWhichStartsWithAnotherLetter [otherFieldWhichStartsWithAnotherLetter] EXACT_MATCH\n" + 
5151
		"src/b110060/Test.java b110060.Test.otherFieldWhichStartsWithAnotherLetter [otherFieldWhichStartsWithAnotherLetter] EXACT_MATCH\n" + 
5205
		"src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH\n" + 
5152
		"src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH\n" + 
Lines 5544-5550 Link Here
5544
 * @test Bug 122442: [search] API inconsistency with IJavaSearchConstants.IMPLEMENTORS and SearchPattern
5491
 * @test Bug 122442: [search] API inconsistency with IJavaSearchConstants.IMPLEMENTORS and SearchPattern
5545
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=122442"
5492
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=122442"
5546
 */
5493
 */
5547
public void testBug122442a() throws CoreException {
5494
private void setUpBug122442a() throws CoreException {
5548
	workingCopies = new ICompilationUnit[3];
5495
	workingCopies = new ICompilationUnit[3];
5549
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b122442/I.java",
5496
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b122442/I.java",
5550
		"package b122442;\n" + 
5497
		"package b122442;\n" + 
Lines 5558-5588 Link Here
5558
		"package b122442;\n" + 
5505
		"package b122442;\n" + 
5559
		"public class X implements I {}\n"
5506
		"public class X implements I {}\n"
5560
	);
5507
	);
5508
}
5509
public void testBug122442a() throws CoreException {
5510
	setUpBug122442a();
5561
	search("I", TYPE, IMPLEMENTORS);
5511
	search("I", TYPE, IMPLEMENTORS);
5562
	this.discard = false;
5563
	assertSearchResults(
5512
	assertSearchResults(
5564
		"src/b122442/II.java b122442.II [I] EXACT_MATCH\n" + 
5513
		"src/b122442/II.java b122442.II [I] EXACT_MATCH\n" + 
5565
		"src/b122442/X.java b122442.X [I] EXACT_MATCH"
5514
		"src/b122442/X.java b122442.X [I] EXACT_MATCH"
5566
	);
5515
	);
5567
}
5516
}
5568
public void testBug122442b() throws CoreException {
5517
public void testBug122442b() throws CoreException {
5569
	assertNotNull("There should be working copies!", workingCopies);
5518
	setUpBug122442a();
5570
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
5571
	search("I", INTERFACE, IMPLEMENTORS);
5519
	search("I", INTERFACE, IMPLEMENTORS);
5572
	this.discard = false;
5573
	assertSearchResults(
5520
	assertSearchResults(
5574
		"src/b122442/II.java b122442.II [I] EXACT_MATCH"
5521
		"src/b122442/II.java b122442.II [I] EXACT_MATCH"
5575
	);
5522
	);
5576
}
5523
}
5577
public void testBug122442c() throws CoreException {
5524
public void testBug122442c() throws CoreException {
5578
	assertNotNull("There should be working copies!", workingCopies);
5525
	setUpBug122442a();
5579
	assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
5580
	search("I", CLASS, IMPLEMENTORS);
5526
	search("I", CLASS, IMPLEMENTORS);
5581
	assertSearchResults(
5527
	assertSearchResults(
5582
		"src/b122442/X.java b122442.X [I] EXACT_MATCH"
5528
		"src/b122442/X.java b122442.X [I] EXACT_MATCH"
5583
	);
5529
	);
5584
}
5530
}
5585
public void testBug122442d() throws CoreException {
5531
private void setUpBug122442d() throws CoreException {
5586
	workingCopies = new ICompilationUnit[1];
5532
	workingCopies = new ICompilationUnit[1];
5587
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b122442/User.java",
5533
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b122442/User.java",
5588
		"class Klass {}\n" + 
5534
		"class Klass {}\n" + 
Lines 5595-5648 Link Here
5595
		"}\n" + 
5541
		"}\n" + 
5596
		"class Sub extends Klass {}"
5542
		"class Sub extends Klass {}"
5597
	);
5543
	);
5544
}
5545
public void testBug122442d() throws CoreException {
5546
	setUpBug122442d();
5598
	search("Interface", TYPE, IMPLEMENTORS);
5547
	search("Interface", TYPE, IMPLEMENTORS);
5599
	this.discard = false;
5600
	assertSearchResults(
5548
	assertSearchResults(
5601
		"src/b122442/User.java void b122442.User.m():<anonymous>#2 [Interface] EXACT_MATCH"
5549
		"src/b122442/User.java void b122442.User.m():<anonymous>#2 [Interface] EXACT_MATCH"
5602
	);
5550
	);
5603
}
5551
}
5604
public void testBug122442e() throws CoreException {
5552
public void testBug122442e() throws CoreException {
5605
	assertNotNull("There should be working copies!", workingCopies);
5553
	setUpBug122442d();
5606
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5607
	search("Interface", INTERFACE, IMPLEMENTORS);
5554
	search("Interface", INTERFACE, IMPLEMENTORS);
5608
	this.discard = false;
5609
	assertSearchResults(
5555
	assertSearchResults(
5610
		"" // expected no result
5556
		"" // expected no result
5611
	);
5557
	);
5612
}
5558
}
5613
public void testBug122442f() throws CoreException {
5559
public void testBug122442f() throws CoreException {
5614
	assertNotNull("There should be working copies!", workingCopies);
5560
	setUpBug122442d();
5615
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5616
	search("Interface", CLASS, IMPLEMENTORS);
5561
	search("Interface", CLASS, IMPLEMENTORS);
5617
	this.discard = false;
5618
	assertSearchResults(
5562
	assertSearchResults(
5619
		"src/b122442/User.java void b122442.User.m():<anonymous>#2 [Interface] EXACT_MATCH"
5563
		"src/b122442/User.java void b122442.User.m():<anonymous>#2 [Interface] EXACT_MATCH"
5620
	);
5564
	);
5621
}
5565
}
5622
public void testBug122442g() throws CoreException {
5566
public void testBug122442g() throws CoreException {
5623
	assertNotNull("There should be working copies!", workingCopies);
5567
	setUpBug122442d();
5624
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5625
	search("Klass", TYPE, IMPLEMENTORS);
5568
	search("Klass", TYPE, IMPLEMENTORS);
5626
	this.discard = false;
5627
	assertSearchResults(
5569
	assertSearchResults(
5628
		"src/b122442/User.java void b122442.User.m():<anonymous>#1 [Klass] EXACT_MATCH\n" + 
5570
		"src/b122442/User.java void b122442.User.m():<anonymous>#1 [Klass] EXACT_MATCH\n" + 
5629
		"src/b122442/User.java b122442.Sub [Klass] EXACT_MATCH"
5571
		"src/b122442/User.java b122442.Sub [Klass] EXACT_MATCH"
5630
	);
5572
	);
5631
}
5573
}
5632
public void testBug122442h() throws CoreException {
5574
public void testBug122442h() throws CoreException {
5633
	assertNotNull("There should be working copies!", workingCopies);
5575
	setUpBug122442d();
5634
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5635
	search("Klass", INTERFACE, IMPLEMENTORS);
5576
	search("Klass", INTERFACE, IMPLEMENTORS);
5636
	this.discard = false;
5637
	assertSearchResults(
5577
	assertSearchResults(
5638
		"" // expected no result
5578
		"" // expected no result
5639
	);
5579
	);
5640
}
5580
}
5641
public void testBug122442i() throws CoreException {
5581
public void testBug122442i() throws CoreException {
5642
	assertNotNull("There should be working copies!", workingCopies);
5582
	setUpBug122442d();
5643
	assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
5644
	search("Klass", CLASS, IMPLEMENTORS);
5583
	search("Klass", CLASS, IMPLEMENTORS);
5645
	this.discard = false;
5646
	assertSearchResults(
5584
	assertSearchResults(
5647
		"src/b122442/User.java void b122442.User.m():<anonymous>#1 [Klass] EXACT_MATCH\n" + 
5585
		"src/b122442/User.java void b122442.User.m():<anonymous>#1 [Klass] EXACT_MATCH\n" + 
5648
		"src/b122442/User.java b122442.Sub [Klass] EXACT_MATCH"
5586
		"src/b122442/User.java b122442.Sub [Klass] EXACT_MATCH"
Lines 6005-6011 Link Here
6005
 * @test Bug 130390: CamelCase algorithm cleanup and improvement
5943
 * @test Bug 130390: CamelCase algorithm cleanup and improvement
6006
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130390"
5944
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130390"
6007
 */
5945
 */
6008
public void testBug130390() throws CoreException {
5946
private void setUpBug130390() throws CoreException {
6009
	workingCopies = new ICompilationUnit[4];
5947
	workingCopies = new ICompilationUnit[4];
6010
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b130390/TZ.java",
5948
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b130390/TZ.java",
6011
		"package b130390;\n" + 
5949
		"package b130390;\n" + 
Lines 6027-6099 Link Here
6027
		"public class NullPointerException {\n" +
5965
		"public class NullPointerException {\n" +
6028
		"}\n"
5966
		"}\n"
6029
	);
5967
	);
5968
}
5969
public void testBug130390() throws CoreException {
5970
	setUpBug130390();
6030
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
5971
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6031
	this.discard = false;
6032
	assertSearchResults(
5972
	assertSearchResults(
6033
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
5973
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6034
	);
5974
	);
6035
}
5975
}
6036
public void testBug130390b() throws CoreException {
5976
public void testBug130390b() throws CoreException {
6037
	assertNotNull("There should be working copies!", workingCopies);
5977
	setUpBug130390();
6038
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6039
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
5978
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6040
	this.discard = false;
6041
	assertSearchResults(
5979
	assertSearchResults(
6042
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" + 
5980
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" + 
6043
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
5981
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6044
	);
5982
	);
6045
}
5983
}
6046
public void testBug130390c() throws CoreException {
5984
public void testBug130390c() throws CoreException {
6047
	assertNotNull("There should be working copies!", workingCopies);
5985
	setUpBug130390();
6048
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6049
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
5986
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6050
	this.discard = false;
6051
	assertSearchResults(
5987
	assertSearchResults(
6052
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
5988
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6053
	);
5989
	);
6054
}
5990
}
6055
public void testBug130390d() throws CoreException {
5991
public void testBug130390d() throws CoreException {
6056
	assertNotNull("There should be working copies!", workingCopies);
5992
	setUpBug130390();
6057
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6058
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5993
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6059
	this.discard = false;
6060
	assertSearchResults(
5994
	assertSearchResults(
6061
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
5995
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6062
	);
5996
	);
6063
}
5997
}
6064
public void testBug130390e() throws CoreException {
5998
public void testBug130390e() throws CoreException {
6065
	assertNotNull("There should be working copies!", workingCopies);
5999
	setUpBug130390();
6066
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6067
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6000
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6068
	this.discard = false;
6069
	assertSearchResults(
6001
	assertSearchResults(
6070
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6002
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6071
	);
6003
	);
6072
}
6004
}
6073
public void testBug130390f() throws CoreException {
6005
public void testBug130390f() throws CoreException {
6074
	assertNotNull("There should be working copies!", workingCopies);
6006
	setUpBug130390();
6075
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6076
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6007
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6077
	this.discard = false;
6078
	assertSearchResults(
6008
	assertSearchResults(
6079
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6009
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6080
	);
6010
	);
6081
}
6011
}
6082
public void testBug130390g() throws CoreException {
6012
public void testBug130390g() throws CoreException {
6083
	assertNotNull("There should be working copies!", workingCopies);
6013
	setUpBug130390();
6084
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6085
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6014
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6086
	this.discard = false;
6087
	assertSearchResults(
6015
	assertSearchResults(
6088
		"src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" + 
6016
		"src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" + 
6089
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6017
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6090
	);
6018
	);
6091
}
6019
}
6092
public void testBug130390h() throws CoreException {
6020
public void testBug130390h() throws CoreException {
6093
	assertNotNull("There should be working copies!", workingCopies);
6021
	setUpBug130390();
6094
	assertEquals("Invalid number of working copies kept between tests!", 4, workingCopies.length);
6095
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6022
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6096
	this.discard = false;
6097
	assertSearchResults(
6023
	assertSearchResults(
6098
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6024
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6099
	);
6025
	);
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java (-11 / +28 lines)
Lines 588-594 Link Here
588
				this.resultCollector);
588
				this.resultCollector);
589
		assertSearchResults("");
589
		assertSearchResults("");
590
	}
590
	}
591
	public void testJavadocTypeParameterReferences01() throws CoreException {
591
	private void setUpJavadocTypeParameterReferences() throws CoreException {
592
		workingCopies = new ICompilationUnit[1];
592
		workingCopies = new ICompilationUnit[1];
593
		workingCopies[0] = getWorkingCopy("/JavaSearch15/src/b81190/Test.java",
593
		workingCopies[0] = getWorkingCopy("/JavaSearch15/src/b81190/Test.java",
594
			"package b81190;\n" + 
594
			"package b81190;\n" + 
Lines 607-616 Link Here
607
			"		o.toString();\n" + 
607
			"		o.toString();\n" + 
608
			"	}\n" + 
608
			"	}\n" + 
609
			"}\n"
609
			"}\n"
610
			);
610
		);
611
	}
612
	public void testJavadocTypeParameterReferences01() throws CoreException {
613
		setUpJavadocTypeParameterReferences();
611
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
614
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
612
		ITypeParameter typeParam = selectTypeParameter(workingCopies[0], "T1", 2);
615
		ITypeParameter typeParam = selectTypeParameter(workingCopies[0], "T1", 2);
613
		discard = false; // use same working copy for next test
614
		search(typeParam, REFERENCES, scope);
616
		search(typeParam, REFERENCES, scope);
615
		assertSearchResults(
617
		assertSearchResults(
616
			"src/b81190/Test.java b81190.Test [T1] EXACT_MATCH INSIDE_JAVADOC\n" + 
618
			"src/b81190/Test.java b81190.Test [T1] EXACT_MATCH INSIDE_JAVADOC\n" + 
Lines 618-628 Link Here
618
		);
620
		);
619
	}
621
	}
620
	public void testJavadocTypeParameterReferences02() throws CoreException {
622
	public void testJavadocTypeParameterReferences02() throws CoreException {
621
		assertNotNull("Problem in tests processing", workingCopies);
623
		setUpJavadocTypeParameterReferences();
622
		assertEquals("Problem in tests processing", 1, workingCopies.length);
623
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
624
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
624
		ITypeParameter typeParam = selectTypeParameter(workingCopies[0], "U", 2);
625
		ITypeParameter typeParam = selectTypeParameter(workingCopies[0], "U", 2);
625
		discard = false; // use same working copy for next test
626
		search(typeParam, REFERENCES, scope);
626
		search(typeParam, REFERENCES, scope);
627
		assertSearchResults(
627
		assertSearchResults(
628
			"src/b81190/Test.java void b81190.Test.generic(U, T1) [U] EXACT_MATCH INSIDE_JAVADOC\n" + 
628
			"src/b81190/Test.java void b81190.Test.generic(U, T1) [U] EXACT_MATCH INSIDE_JAVADOC\n" + 
Lines 631-638 Link Here
631
	}
631
	}
632
	// Local variables references in Javadoc have been fixed while implementing 81190
632
	// Local variables references in Javadoc have been fixed while implementing 81190
633
	public void testJavadocParameterReferences01() throws CoreException {
633
	public void testJavadocParameterReferences01() throws CoreException {
634
		assertNotNull("Problem in tests processing", workingCopies);
634
		setUpJavadocTypeParameterReferences();
635
		assertEquals("Problem in tests processing", 1, workingCopies.length);
636
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
635
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(workingCopies);
637
		ILocalVariable local = selectLocalVariable(workingCopies[0], "x", 2);
636
		ILocalVariable local = selectLocalVariable(workingCopies[0], "x", 2);
638
		search(local, REFERENCES, scope);
637
		search(local, REFERENCES, scope);
Lines 966-972 Link Here
966
		for (int i=0,l=methods.length; i<l; i++) {
965
		for (int i=0,l=methods.length; i<l; i++) {
967
			search(methods[i], REFERENCES, getJavaSearchScope());
966
			search(methods[i], REFERENCES, getJavaSearchScope());
968
		}
967
		}
969
		discard = false; // use working copy for next test
970
		assertSearchResults(
968
		assertSearchResults(
971
			"src/b83285/A.java b83285.B$C(String) [B(Exception)] EXACT_MATCH INSIDE_JAVADOC\n" + 
969
			"src/b83285/A.java b83285.B$C(String) [B(Exception)] EXACT_MATCH INSIDE_JAVADOC\n" + 
972
			"src/b83285/A.java b83285.B$C(String) [foo()] EXACT_MATCH INSIDE_JAVADOC"
970
			"src/b83285/A.java b83285.B$C(String) [foo()] EXACT_MATCH INSIDE_JAVADOC"
Lines 974-981 Link Here
974
	}
972
	}
975
	public void testBug83285b() throws CoreException {
973
	public void testBug83285b() throws CoreException {
976
		resultCollector.showRule = true;
974
		resultCollector.showRule = true;
977
		assertNotNull("Problem in tests processing", workingCopies);
975
		workingCopies = new ICompilationUnit[1];
978
		assertEquals("Problem in tests processing", 1, workingCopies.length);
976
		workingCopies[0] = getWorkingCopy("/JavaSearch/src/b83285/A.java",
977
			"package b83285;\n" + 
978
			"class A {\n" + 
979
			"	A(char c) {}\n" + 
980
			"}\n" + 
981
			"class B {\n" + 
982
			"	B(Exception ex) {}\n" + 
983
			"	void foo() {} \n" + 
984
			"	class C { \n" + 
985
			"	    /**\n" + 
986
			"	     * Link {@link #B(Exception)} OK\n" + 
987
			"	     * Link {@link #C(String)} OK\n" + 
988
			"	     * Link {@link #foo()} OK\n" + 
989
			"	     * Link {@link #bar()} OK\n" + 
990
			"	     */\n" + 
991
			"	    public C(String str) {}\n" + 
992
			"		void bar() {}\n" + 
993
			"	}\n" + 
994
			"}"
995
		);
979
		IMethod[] methods = workingCopies[0].getType("B").getType("C").getMethods();
996
		IMethod[] methods = workingCopies[0].getType("B").getType("C").getMethods();
980
		assertEquals("Invalid number of methods", 2, methods.length);
997
		assertEquals("Invalid number of methods", 2, methods.length);
981
		for (int i=0,l=methods.length; i<l; i++) {
998
		for (int i=0,l=methods.length; i<l; i++) {
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericTypeExactTests.java (-1 / +1 lines)
Lines 40-46 Link Here
40
	}
40
	}
41
	public static Test suite() {
41
	public static Test suite() {
42
		TestSuite suite = new Suite(JavaSearchGenericTypeExactTests.class.getName());
42
		TestSuite suite = new Suite(JavaSearchGenericTypeExactTests.class.getName());
43
		List tests = buildTestsList(JavaSearchGenericTypeExactTests.class, 1);
43
		List tests = buildTestsList(JavaSearchGenericTypeExactTests.class, 1, 0/* do not sort*/);
44
		for (int index=0, size=tests.size(); index<size; index++) {
44
		for (int index=0, size=tests.size(); index<size; index++) {
45
			suite.addTest((Test)tests.get(index));
45
			suite.addTest((Test)tests.get(index));
46
		}
46
		}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericConstructorExactTests.java (-1 / +1 lines)
Lines 31-37 Link Here
31
31
32
	public static Test suite() {
32
	public static Test suite() {
33
		TestSuite suite = new Suite(JavaSearchGenericConstructorExactTests.class.getName());
33
		TestSuite suite = new Suite(JavaSearchGenericConstructorExactTests.class.getName());
34
		List tests = buildTestsList(JavaSearchGenericConstructorExactTests.class, 1);
34
		List tests = buildTestsList(JavaSearchGenericConstructorExactTests.class, 1, 0/* do not sort*/);
35
		for (int index=0, size=tests.size(); index<size; index++) {
35
		for (int index=0, size=tests.size(); index<size; index++) {
36
			suite.addTest((Test)tests.get(index));
36
			suite.addTest((Test)tests.get(index));
37
		}
37
		}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericConstructorEquivalentTests.java (-1 / +1 lines)
Lines 31-37 Link Here
31
31
32
	public static Test suite() {
32
	public static Test suite() {
33
		TestSuite suite = new Suite(JavaSearchGenericConstructorEquivalentTests.class.getName());
33
		TestSuite suite = new Suite(JavaSearchGenericConstructorEquivalentTests.class.getName());
34
		List tests = buildTestsList(JavaSearchGenericConstructorEquivalentTests.class, 1);
34
		List tests = buildTestsList(JavaSearchGenericConstructorEquivalentTests.class, 1, 0/* do not sort*/);
35
		for (int index=0, size=tests.size(); index<size; index++) {
35
		for (int index=0, size=tests.size(); index<size; index++) {
36
			suite.addTest((Test)tests.get(index));
36
			suite.addTest((Test)tests.get(index));
37
		}
37
		}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchGenericTypeEquivalentTests.java (-1 / +1 lines)
Lines 33-39 Link Here
33
	}
33
	}
34
	public static Test suite() {
34
	public static Test suite() {
35
		TestSuite suite = new Suite(JavaSearchGenericTypeEquivalentTests.class.getName());
35
		TestSuite suite = new Suite(JavaSearchGenericTypeEquivalentTests.class.getName());
36
		List tests = buildTestsList(JavaSearchGenericTypeEquivalentTests.class, 1);
36
		List tests = buildTestsList(JavaSearchGenericTypeEquivalentTests.class, 1, 0/* do not sort*/);
37
		for (int index=0, size=tests.size(); index<size; index++) {
37
		for (int index=0, size=tests.size(); index<size; index++) {
38
			suite.addTest((Test)tests.get(index));
38
			suite.addTest((Test)tests.get(index));
39
		}
39
		}
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavadocCompletionModelTest.java (-7 lines)
Lines 389-401 Link Here
389
		return toDisplay.replaceAll(", 8}", ", \"+JAVADOC_RELEVANCE+\"}");
389
		return toDisplay.replaceAll(", 8}", ", \"+JAVADOC_RELEVANCE+\"}");
390
	}
390
	}
391
391
392
	/* (non-Javadoc)
393
	 * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelCompletionTests#setUp()
394
	 */
395
	protected void setUp() throws Exception {
396
		super.setUp();
397
	}
398
399
	protected void setUpProjectOptions(String compliance) throws JavaModelException {
392
	protected void setUpProjectOptions(String compliance) throws JavaModelException {
400
		try {
393
		try {
401
			setUpProjectCompliance(COMPLETION_PROJECT, compliance);
394
			setUpProjectCompliance(COMPLETION_PROJECT, compliance);
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (-7600 / +7601 lines)
Lines 43-1668 Link Here
43
//	TESTS_NAMES = new String[] { "testDeprecationCheck17"};
43
//	TESTS_NAMES = new String[] { "testDeprecationCheck17"};
44
}
44
}
45
public static Test suite() {
45
public static Test suite() {
46
	return buildModelTestSuite(CompletionTests.class);
46
	// TODO (david) make execution independant from tests order
47
	return buildModelTestSuite(CompletionTests.class, 1/*sort ascending order*/);
47
}
48
}
48
49
public void testParameterNames1() throws CoreException, IOException {
49
/**
50
	Map options = COMPLETION_PROJECT.getOptions(true);
50
 * Ensures that completion is not case sensitive
51
	Object timeout = options.get(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC);
51
 */
52
	try {
52
public void testCompletionCaseInsensitive() throws JavaModelException {
53
		options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000");
53
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
54
		COMPLETION_PROJECT.setOptions(options);
54
	ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitive.java");
55
		this.workingCopies = new ICompilationUnit[1];
56
		this.workingCopies[0] = getWorkingCopy(
57
			"/Completion/src/p/Test.java",
58
			"package p;"+
59
			"public class Test {\n" + 
60
			"  void foo(doctest.X x) {\n" + 
61
			"    x.fo\n" + 
62
			"  }\n" + 
63
			"}\n");
64
		
65
		addLibrary(
66
				"Completion", 
67
				"tmpDoc.jar",
68
				null,
69
				"tmpDocDoc.zip",
70
				false);
71
		
72
		CompletionTestsRequestor2 requestor;
73
		try {
74
			requestor = new CompletionTestsRequestor2(true);
75
			String str = this.workingCopies[0].getSource();
76
			String completeBehind = "x.fo";
77
			int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
78
			this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
79
			
80
			assertResults(
81
				"foo[METHOD_REF]{foo(), Ldoctest.X;, (Ljava.lang.Object;)V, foo, (param), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
82
				requestor.getResults());
83
		} finally {
84
			removeLibrary("Completion", "tmpDoc.jar");
85
		}
86
	} finally {
87
		options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, timeout);
88
		COMPLETION_PROJECT.setOptions(options);
89
	}
90
}
91
public void testInconsistentHierarchy1() throws CoreException, IOException {
92
	this.workingCopies = new ICompilationUnit[1];
93
	this.workingCopies[0] = getWorkingCopy(
94
		"/Completion/src/p/Test.java",
95
		"package p;"+
96
		"public class Test extends Unknown {\n" + 
97
		"  void foo() {\n" + 
98
		"    this.has\n" + 
99
		"  }\n" + 
100
		"}\n");
55
	
101
	
56
	String str = cu.getSource();
102
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
57
	String completeBehind = "Fiel";
103
	String str = this.workingCopies[0].getSource();
104
	String completeBehind = "this.has";
58
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
105
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
59
	cu.codeComplete(cursorLocation, requestor);
106
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
60
	
107
	
61
	assertEquals("should have one class",
108
	assertResults(
62
		"element:field    completion:field    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_STATIC + R_NON_RESTRICTED),
109
		"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
63
		requestor.getResults());
110
		requestor.getResults());
64
}
111
}
65
/**
112
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
66
 * Complete a package in a case insensitive way
113
public void testDeprecationCheck1() throws JavaModelException {
67
 */
114
	Map options = COMPLETION_PROJECT.getOptions(true);
68
public void testCompletionCaseInsensitivePackage() throws JavaModelException {
115
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
69
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
116
	try {
70
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitivePackage.java");
117
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
71
118
		COMPLETION_PROJECT.setOptions(options);
72
	String str = cu.getSource();
119
		
73
	String completeBehind = "Ja";
120
		this.workingCopies = new ICompilationUnit[3];
74
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
121
		this.workingCopies[0] = getWorkingCopy(
122
			"/Completion/src/deprecation/Test.java",
123
			"package deprecation;"+
124
			"public class Test {\n"+
125
			"  ZZZTy\n"+
126
			"}");
127
		
128
		this.workingCopies[1] = getWorkingCopy(
129
			"/Completion/src/deprecation/ZZZType1.java",
130
			"package deprecation;"+
131
			"public class ZZZType1 {\n"+
132
			"}");
133
		
134
		this.workingCopies[2] = getWorkingCopy(
135
			"/Completion/src/deprecation/ZZZType2.java",
136
			"package deprecation;"+
137
			"/** @deprecated */\n"+
138
			"public class ZZZType2 {\n"+
139
			"}");
75
	
140
	
76
	cu.codeComplete(cursorLocation, requestor);
141
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
77
	assertEquals(
142
		String str = this.workingCopies[0].getSource();
78
		"should have package completions",
143
		String completeBehind = "ZZZTy";
79
		"element:jarpack1    completion:jarpack1    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" +
144
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
80
		"element:jarpack2    completion:jarpack2    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" +
145
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
81
		"element:java    completion:java    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" +
146
	
82
		"element:java.io    completion:java.io    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" +
147
		assertResults(
83
		"element:java.lang    completion:java.lang    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED),
148
				"ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
84
		requestor.getResults());
149
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
150
				"ZZZType2[TYPE_REF]{ZZZType2, deprecation, Ldeprecation.ZZZType2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
151
				requestor.getResults());
152
	} finally {
153
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
154
		COMPLETION_PROJECT.setOptions(options);
155
	}
85
}
156
}
86
157
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
87
/**
158
public void testDeprecationCheck2() throws JavaModelException {
88
 * Complete at end of file.
159
	Map options = COMPLETION_PROJECT.getOptions(true);
89
 */
160
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
90
public void testCompletionEndOfCompilationUnit() throws JavaModelException {
161
	try {
91
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
162
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
92
	ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionEndOfCompilationUnit.java");
163
		COMPLETION_PROJECT.setOptions(options);
93
	cu.codeComplete(cu.getSourceRange().getOffset() + cu.getSourceRange().getLength(), requestor);
164
		
94
	assertEquals(
165
		this.workingCopies = new ICompilationUnit[3];
95
		"should have two methods of 'foo'", 
166
		this.workingCopies[0] = getWorkingCopy(
96
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
167
			"/Completion/src/deprecation/Test.java",
97
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED),
168
			"package deprecation;"+
98
		requestor.getResults());	
169
			"public class Test {\n"+
170
			"  ZZZTy\n"+
171
			"}");
172
		
173
		this.workingCopies[1] = getWorkingCopy(
174
			"/Completion/src/deprecation/ZZZType1.java",
175
			"package deprecation;"+
176
			"public class ZZZType1 {\n"+
177
			"}");
178
		
179
		this.workingCopies[2] = getWorkingCopy(
180
			"/Completion/src/deprecation/ZZZType2.java",
181
			"package deprecation;"+
182
			"/** @deprecated */\n"+
183
			"public class ZZZType2 {\n"+
184
			"}");
185
	
186
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
187
		String str = this.workingCopies[0].getSource();
188
		String completeBehind = "ZZZTy";
189
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
190
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
191
	
192
		assertResults(
193
				"ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
194
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
195
				requestor.getResults());
196
	} finally {
197
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
198
		COMPLETION_PROJECT.setOptions(options);
199
	}
99
}
200
}
100
201
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
101
/**
202
public void testDeprecationCheck3() throws JavaModelException {
102
 * Complete the type "A" from "new A".
203
	Map options = COMPLETION_PROJECT.getOptions(true);
103
 */
204
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
104
public void testCompletionFindClass() throws JavaModelException {
205
	try {
105
	this.wc = getWorkingCopy(
206
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
106
            "/Completion/src/CompletionFindClass.java",
207
		COMPLETION_PROJECT.setOptions(options);
107
            "public class CompletionFindClass {\n" +
208
		
108
            "	private    A[] a;\n" +
209
		this.workingCopies = new ICompilationUnit[2];
109
            "	public CompletionFindClass () {\n" +
210
		this.workingCopies[0] = getWorkingCopy(
110
            "		this.a = new A\n" +
211
			"/Completion/src/deprecation/Test.java",
111
            "	}\n" +
212
			"package deprecation;"+
112
            "}");
213
			"public class Test {\n"+
113
    
214
			"  void foo() {"+
114
    
215
			"    ZZZType1.fo\n"+
115
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
216
			"  }"+
116
    String str = this.wc.getSource();
217
			"}");
117
    String completeBehind = "A";
218
		
118
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
219
		this.workingCopies[1] = getWorkingCopy(
119
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
220
			"/Completion/src/deprecation/ZZZType1.java",
120
221
			"package deprecation;"+
121
    assertResults(
222
			"public class ZZZType1 {\n"+
122
    		"ABC[TYPE_REF]{p1.ABC, p1, Lp1.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
223
			"  public static void foo1(){}\n"+
123
    		"ABC[TYPE_REF]{p2.ABC, p2, Lp2.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
224
			"  /** @deprecated */\n"+
124
			"A3[TYPE_REF]{A3, , LA3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
225
			"  public static void foo2(){}\n"+
125
			"A[TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
226
			"}");
126
            requestor.getResults());
227
	
228
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
229
		String str = this.workingCopies[0].getSource();
230
		String completeBehind = "ZZZType1.fo";
231
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
232
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
233
	
234
		assertResults(
235
				"foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
236
				"foo2[METHOD_REF]{foo2(), Ldeprecation.ZZZType1;, ()V, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
237
				requestor.getResults());
238
	} finally {
239
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
240
		COMPLETION_PROJECT.setOptions(options);
241
	}
127
}
242
}
128
243
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
129
/**
244
public void testDeprecationCheck4() throws JavaModelException {
130
 * The same type must be find only once
245
	Map options = COMPLETION_PROJECT.getOptions(true);
131
 */
246
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
132
public void testCompletionFindClass2() throws JavaModelException {
247
	try {
133
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
248
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
134
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindClass2.java");
249
		COMPLETION_PROJECT.setOptions(options);
135
250
		
136
	String str = cu.getSource();
251
		this.workingCopies = new ICompilationUnit[2];
137
	String completeBehind = "PX";
252
		this.workingCopies[0] = getWorkingCopy(
138
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
253
			"/Completion/src/deprecation/Test.java",
139
	cu.codeComplete(cursorLocation, requestor);
254
			"package deprecation;"+
140
255
			"public class Test {\n"+
141
	assertEquals(
256
			"  void foo() {"+
142
		"should have one classe", 
257
			"    ZZZType1.fo\n"+
143
		"element:PX    completion:pack1.PX    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_QUALIFIED + R_NON_RESTRICTED),
258
			"  }"+
144
		requestor.getResults());
259
			"}");
145
}
260
		
146
261
		this.workingCopies[1] = getWorkingCopy(
147
262
			"/Completion/src/deprecation/ZZZType1.java",
148
/**
263
			"package deprecation;"+
149
 * Complete the type "Default" in the default package example.
264
			"public class ZZZType1 {\n"+
150
 */
265
			"  public static void foo1(){}\n"+
151
public void testCompletionFindClassDefaultPackage() throws JavaModelException {
266
			"  /** @deprecated */\n"+
152
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
267
			"  public static void foo2(){}\n"+
153
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionDefaultPackage.java");
268
			"}");
154
155
	String str = cu.getSource();
156
	String completeBehind = "Def";
157
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
158
	cu.codeComplete(cursorLocation, requestor);
159
160
	assertEquals(
161
		"should have one class", 
162
		"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
163
		requestor.getResults());	
164
}
165
166
/**
167
 * Complete the constructor "CompletionFindConstructor" from "new CompletionFindConstructor(".
168
 */
169
public void testCompletionFindConstructor() throws JavaModelException {
170
	this.wc = getWorkingCopy(
171
            "/Completion/src/CompletionFindConstructor.java",
172
            "public class CompletionFindConstructor {\n"+
173
            "	public CompletionFindConstructor (int i) {\n"+
174
            "	}\n"+
175
            "	publuc void foo(){\n"+
176
            "		int x = 45;\n"+
177
            "		new CompletionFindConstructor(i);\n"+
178
            "	}\n"+
179
            "}");
180
    
181
    
182
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
183
    
184
    String str = this.wc.getSource();
185
    String completeBehind = "CompletionFindConstructor(";
186
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
187
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
188
189
    assertResults(
190
            "expectedTypesSignatures=null\n"+
191
            "expectedTypesKeys=null",
192
            requestor.getContext());
193
    
194
   assertResults(
195
			"CompletionFindConstructor[ANONYMOUS_CLASS_DECLARATION]{, LCompletionFindConstructor;, (I)V, null, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
196
			"CompletionFindConstructor[METHOD_REF<CONSTRUCTOR>]{, LCompletionFindConstructor;, (I)V, CompletionFindConstructor, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}",
197
			requestor.getResults());
198
}
199
200
/**
201
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
202
 */
203
public void testCompletionFindConstructor2() throws JavaModelException {
204
	this.wc = getWorkingCopy(
205
            "/Completion/src/CompletionFindConstructor2.java",
206
            "import zconstructors.*;\n"+
207
            "public class CompletionFindConstructor2 {\n"+
208
            "	Constructor2 c = new Constructor2();\n"+
209
            "}");
210
    
211
    
212
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
213
    
214
    String str = this.wc.getSource();
215
    String completeBehind = "Constructor2(";
216
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
217
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
218
219
    assertResults(
220
            "expectedTypesSignatures=null\n"+
221
            "expectedTypesKeys=null",
222
            requestor.getContext());
223
    
224
    assertEquals(
225
			"Constructor2[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor2;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
226
			"Constructor2[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor2;, ()V, Constructor2, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
227
			requestor.getResults());
228
}
229
230
/**
231
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
232
 */
233
public void testCompletionFindConstructor3() throws JavaModelException {
234
	this.wc = getWorkingCopy(
235
            "/Completion/src/CompletionFindConstructor3.java",
236
            "import zconstructors.*;\n"+
237
            "public class CompletionFindConstructor3 {\n"+
238
            "	Constructor3 c = new Constructor3();\n"+
239
            "}");
240
    
241
    
242
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
243
    
244
    String str = this.wc.getSource();
245
    String completeBehind = "Constructor3(";
246
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
247
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
248
249
    assertResults(
250
            "expectedTypesSignatures=null\n"+
251
            "expectedTypesKeys=null",
252
            requestor.getContext());
253
    
254
    assertEquals(
255
			"Constructor3[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor3;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
256
			"Constructor3[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor3;, ()V, Constructor3, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
257
			requestor.getResults());
258
}
259
/**
260
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
261
 */
262
public void testCompletionFindConstructor4() throws JavaModelException {
263
	this.wc = getWorkingCopy(
264
            "/Completion/src/CompletionFindConstructor4.java",
265
            "import zconstructors.*;\n"+
266
            "public class CompletionFindConstructor4 {\n"+
267
            "	Constructor4 c = new Constructor4();\n"+
268
            "}");
269
    
270
    
271
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
272
    
273
    String str = this.wc.getSource();
274
    String completeBehind = "Constructor4(";
275
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
276
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
277
278
    assertResults(
279
            "expectedTypesSignatures=null\n"+
280
            "expectedTypesKeys=null",
281
            requestor.getContext());
282
    
283
	assertEquals(
284
			"Constructor4[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor4;, (I)V, null, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
285
			"Constructor4[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor4;, (I)V, Constructor4, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
286
			requestor.getResults());
287
}
288
/**
289
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
290
 */
291
public void testCompletionFindConstructor5() throws JavaModelException {
292
	this.wc = getWorkingCopy(
293
            "/Completion/src/CompletionFindConstructor5.java",
294
            "import zconstructors.*;\n"+
295
            "public class CompletionFindConstructor5 {\n"+
296
            "	Constructor5 c = new Constructor5();\n"+
297
            "}");
298
    
299
    
300
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
301
    
302
    String str = this.wc.getSource();
303
    String completeBehind = "Constructor5(";
304
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
305
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
306
307
    assertResults(
308
            "expectedTypesSignatures=null\n"+
309
            "expectedTypesKeys=null",
310
            requestor.getContext());
311
    
312
	assertEquals(
313
			"Constructor5[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor5;, (I)V, null, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
314
			"Constructor5[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor5;, (I)V, Constructor5, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
315
			requestor.getResults());
316
}
317
/**
318
 * Complete the exception "Exception" in a catch clause.
319
 */
320
public void testCompletionFindExceptions1() throws JavaModelException {
321
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
322
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException1.java");
323
324
	String str = cu.getSource();
325
	String completeBehind = "Ex";
326
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
327
	cu.codeComplete(cursorLocation, requestor);
328
	
269
	
329
	assertEquals(
270
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
330
		"should have one class", 
271
		String str = this.workingCopies[0].getSource();
331
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED),
272
		String completeBehind = "ZZZType1.fo";
332
		requestor.getResults());
273
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
333
}
274
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
334
275
	
335
/**
276
		assertResults(
336
 * Complete the exception "Exception" in a throws clause.
277
				"foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
337
 */
278
				requestor.getResults());
338
public void testCompletionFindExceptions2() throws JavaModelException {
279
	} finally {
339
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
280
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
340
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException2.java");
281
		COMPLETION_PROJECT.setOptions(options);
341
282
	}
342
	String str = cu.getSource();
343
	String completeBehind = "Ex";
344
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
345
	cu.codeComplete(cursorLocation, requestor);
346
347
	assertEquals(
348
		"should have one class",
349
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED),
350
		requestor.getResults());
351
}
283
}
352
284
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
353
/**
285
public void testDeprecationCheck5() throws JavaModelException {
354
 * Complete the field "var" from "va";
286
	Map options = COMPLETION_PROJECT.getOptions(true);
355
 */
287
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
356
public void testCompletionFindField1() throws JavaModelException {
288
	try {
357
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
289
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
358
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField1.java");
290
		COMPLETION_PROJECT.setOptions(options);
359
291
		
360
	String str = cu.getSource();
292
		this.workingCopies = new ICompilationUnit[2];
361
	String completeBehind = "va";
293
		this.workingCopies[0] = getWorkingCopy(
362
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
294
			"/Completion/src/deprecation/Test.java",
363
	cu.codeComplete(cursorLocation, requestor);
295
			"package deprecation;"+
296
			"public class Test {\n"+
297
			"  ZZZType1.Inn\n"+
298
			"}");
299
		
300
		this.workingCopies[1] = getWorkingCopy(
301
			"/Completion/src/deprecation/ZZZType1.java",
302
			"package deprecation;"+
303
			"public class ZZZType1 {\n"+
304
			"  public class Inner1 {}\n"+
305
			"  /** @deprecated */\n"+
306
			"  public class Inner2 {}\n"+
307
			"}");
364
	
308
	
365
	assertEquals(
309
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
366
		"should have one field: 'var' and one variable: 'var'", 
310
		String str = this.workingCopies[0].getSource();
367
		"element:var    completion:this.var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n"+
311
		String completeBehind = "ZZZType1.Inn";
368
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
312
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
369
		requestor.getResults());	
313
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
314
	
315
		assertResults(
316
				"ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
317
				"ZZZType1.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.ZZZType1$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
318
				requestor.getResults());
319
	} finally {
320
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
321
		COMPLETION_PROJECT.setOptions(options);
322
	}
370
}
323
}
371
324
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
372
/**
325
public void testDeprecationCheck6() throws JavaModelException {
373
 * Complete the field "var" from "this.va";
326
	Map options = COMPLETION_PROJECT.getOptions(true);
374
 */
327
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
375
public void testCompletionFindField2() throws JavaModelException {
328
	try {
376
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
329
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
377
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField2.java");
330
		COMPLETION_PROJECT.setOptions(options);
378
331
		
379
	String str = cu.getSource();
332
		this.workingCopies = new ICompilationUnit[2];
380
	String completeBehind = "va";
333
		this.workingCopies[0] = getWorkingCopy(
381
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
334
			"/Completion/src/deprecation/Test.java",
382
	cu.codeComplete(cursorLocation, requestor);
335
			"package deprecation;"+
336
			"public class Test {\n"+
337
			"  ZZZType1.Inn\n"+
338
			"}");
339
		
340
		this.workingCopies[1] = getWorkingCopy(
341
			"/Completion/src/deprecation/ZZZType1.java",
342
			"package deprecation;"+
343
			"public class ZZZType1 {\n"+
344
			"  public class Inner1 {}\n"+
345
			"  /** @deprecated */\n"+
346
			"  public class Inner2 {}\n"+
347
			"}");
383
	
348
	
384
	assertEquals(
349
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
385
		"should have 1 field of starting with 'va'",
350
		String str = this.workingCopies[0].getSource();
386
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
351
		String completeBehind = "ZZZType1.Inn";
387
		requestor.getResults());
352
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
388
}
353
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
389
354
	
390
public void testCompletionFindField3() throws JavaModelException {
355
		assertResults(
391
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
356
				"ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
392
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField3.java");
357
				requestor.getResults());
393
358
	} finally {
394
	String str = cu.getSource();
359
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
395
	String completeBehind = "b.ba";
360
		COMPLETION_PROJECT.setOptions(options);
396
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
361
	}
397
	cu.codeComplete(cursorLocation, requestor);
398
399
	assertEquals(
400
		"element:bar    completion:bar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED),
401
		requestor.getResults());
402
}
362
}
403
363
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
404
/**
364
public void testDeprecationCheck7() throws JavaModelException {
405
 * Complete the import, "import pac"
365
	Map options = COMPLETION_PROJECT.getOptions(true);
406
 */
366
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
407
public void testCompletionFindImport1() throws JavaModelException {
367
	try {
408
	this.wc = getWorkingCopy(
368
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
409
            "/Completion/src/CompletionFindImport1.java",
369
		COMPLETION_PROJECT.setOptions(options);
410
            "import pac\n"+
370
		
411
            "\n"+
371
		this.workingCopies = new ICompilationUnit[2];
412
            "public class CompletionFindImport1 {\n"+
372
		this.workingCopies[0] = getWorkingCopy(
413
            "\n"+
373
			"/Completion/src/deprecation/Test.java",
414
            "}");
374
			"package deprecation;"+
415
    
375
			"public class Test {\n"+
416
    
376
			"  void foo() {"+
417
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
377
			"    ZZZType1.fo\n"+
418
    String str = this.wc.getSource();
378
			"  }"+
419
    String completeBehind = "pac";
379
			"}");
420
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
380
		
421
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
381
		this.workingCopies[1] = getWorkingCopy(
422
    
382
			"/Completion/src/deprecation/ZZZType1.java",
423
	assertResults(
383
			"package deprecation;"+
424
			"pack[PACKAGE_REF]{pack.*;, pack, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
384
			"public class ZZZType1 {\n"+
425
			"pack1[PACKAGE_REF]{pack1.*;, pack1, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
385
			"  public static int foo1;\n"+
426
			"pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
386
			"  /** @deprecated */\n"+
427
			"pack2[PACKAGE_REF]{pack2.*;, pack2, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) +"}",
387
			"  public static int foo2;\n"+
428
			requestor.getResults());
388
			"}");
389
	
390
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
391
		String str = this.workingCopies[0].getSource();
392
		String completeBehind = "ZZZType1.fo";
393
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
394
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
395
	
396
		assertResults(
397
				"foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
398
				"foo2[FIELD_REF]{foo2, Ldeprecation.ZZZType1;, I, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
399
				requestor.getResults());
400
	} finally {
401
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
402
		COMPLETION_PROJECT.setOptions(options);
403
	}
429
}
404
}
430
405
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
431
public void testCompletionFindImport2() throws JavaModelException {
406
public void testDeprecationCheck8() throws JavaModelException {
432
	this.wc = getWorkingCopy(
407
	Map options = COMPLETION_PROJECT.getOptions(true);
433
            "/Completion/src/CompletionFindImport2.java",
408
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
434
            "import pack1.P\n"+
409
	try {
435
            "\n"+
410
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
436
            "public class CompletionFindImport2 {\n"+
411
		COMPLETION_PROJECT.setOptions(options);
437
            "\n"+
412
		
438
            "}");
413
		this.workingCopies = new ICompilationUnit[2];
439
    
414
		this.workingCopies[0] = getWorkingCopy(
440
    
415
			"/Completion/src/deprecation/Test.java",
441
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
416
			"package deprecation;"+
442
    String str = this.wc.getSource();
417
			"public class Test {\n"+
443
    String completeBehind = "pack1.P";
418
			"  void foo() {"+
444
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
419
			"    ZZZType1.fo\n"+
445
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
420
			"  }"+
446
    
421
			"}");
447
	assertResults(
422
		
448
			"pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+
423
		this.workingCopies[1] = getWorkingCopy(
449
			"PX[TYPE_REF]{pack1.PX;, pack1, Lpack1.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}",
424
			"/Completion/src/deprecation/ZZZType1.java",
450
			requestor.getResults());
425
			"package deprecation;"+
426
			"public class ZZZType1 {\n"+
427
			"  public static int foo1;\n"+
428
			"  /** @deprecated */\n"+
429
			"  public static int foo2;\n"+
430
			"}");
431
	
432
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
433
		String str = this.workingCopies[0].getSource();
434
		String completeBehind = "ZZZType1.fo";
435
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
436
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
437
	
438
		assertResults(
439
				"foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
440
				requestor.getResults());
441
	} finally {
442
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
443
		COMPLETION_PROJECT.setOptions(options);
444
	}
451
}
445
}
452
446
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
453
/**
447
public void testDeprecationCheck9() throws JavaModelException {
454
 * Complete the local variable "var";
448
	Map options = COMPLETION_PROJECT.getOptions(true);
455
 */
449
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
456
public void testCompletionFindLocalVariable() throws JavaModelException {
450
	try {
457
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
451
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
458
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindLocalVariable.java");
452
		COMPLETION_PROJECT.setOptions(options);
459
453
		
460
	String str = cu.getSource();
454
		this.workingCopies = new ICompilationUnit[1];
461
	String completeBehind = "va";
455
		this.workingCopies[0] = getWorkingCopy(
462
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
456
			"/Completion/src/deprecation/Test.java",
463
	cu.codeComplete(cursorLocation, requestor);
457
			"package deprecation;"+
464
	assertEquals(
458
			"public class Test {\n"+
465
		"should have one local variable of 'var'", 
459
			"  public void bar1(){}\n"+
466
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
460
			"  /** @deprecated */\n"+
467
		requestor.getResults());	
461
			"  public void bar2(){}\n"+
462
			"  void foo() {"+
463
			"    bar\n"+
464
			"  }"+
465
			"}");
466
	
467
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
468
		String str = this.workingCopies[0].getSource();
469
		String completeBehind = "bar";
470
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
471
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
472
	
473
		assertResults(
474
				"bar1[METHOD_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
475
				"bar2[METHOD_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
476
				requestor.getResults());
477
	} finally {
478
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
479
		COMPLETION_PROJECT.setOptions(options);
480
	}
468
}
481
}
469
482
470
/**
483
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
471
 * Complete the method call "a.foobar" from "a.fooba";
484
public void testDeprecationCheck10() throws JavaModelException {
472
 */
485
	Map options = COMPLETION_PROJECT.getOptions(true);
473
public void testCompletionFindMethod1() throws JavaModelException {
486
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
474
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
487
	try {
475
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod1.java");
488
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
476
489
		COMPLETION_PROJECT.setOptions(options);
477
	String str = cu.getSource();
490
		
478
	String completeBehind = "fooba";
491
		this.workingCopies = new ICompilationUnit[1];
479
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
492
		this.workingCopies[0] = getWorkingCopy(
480
	cu.codeComplete(cursorLocation, requestor);
493
			"/Completion/src/deprecation/Test.java",
481
	assertEquals(
494
			"package deprecation;"+
482
		"should have two methods of 'foobar'", 
495
			"public class Test {\n"+
483
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
496
			"  public void bar1(){}\n"+
484
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
497
			"  /** @deprecated */\n"+
485
		requestor.getResults());		
498
			"  public void bar2(){}\n"+
499
			"  void foo() {"+
500
			"    bar\n"+
501
			"  }"+
502
			"}");
503
	
504
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
505
		String str = this.workingCopies[0].getSource();
506
		String completeBehind = "bar";
507
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
508
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
509
	
510
		assertResults(
511
				"bar1[METHOD_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
512
				"bar2[METHOD_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
513
				requestor.getResults());
514
	} finally {
515
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
516
		COMPLETION_PROJECT.setOptions(options);
517
	}
486
}
518
}
487
519
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
488
520
public void testDeprecationCheck11() throws JavaModelException {
489
/**
521
	Map options = COMPLETION_PROJECT.getOptions(true);
490
 * Too much Completion match on interface
522
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
491
 */
523
	try {
492
public void testCompletionFindMethod2() throws JavaModelException {
524
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
525
		COMPLETION_PROJECT.setOptions(options);
526
		
527
		this.workingCopies = new ICompilationUnit[1];
528
		this.workingCopies[0] = getWorkingCopy(
529
			"/Completion/src/deprecation/Test.java",
530
			"package deprecation;"+
531
			"public class Test {\n"+
532
			"  public int bar1;\n"+
533
			"  /** @deprecated */\n"+
534
			"  public int bar2;\n"+
535
			"  void foo() {"+
536
			"    bar\n"+
537
			"  }"+
538
			"}");
493
	
539
	
494
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
540
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
495
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod2.java");
541
		String str = this.workingCopies[0].getSource();
496
542
		String completeBehind = "bar";
497
	String str = cu.getSource();
543
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
498
	String completeBehind = "fooba";
544
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
499
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
545
	
500
	cu.codeComplete(cursorLocation, requestor);
546
		assertResults(
501
547
				"bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
502
	assertEquals(
548
				"bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
503
		"should have two completions", 
549
				requestor.getResults());
504
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
550
	} finally {
505
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
551
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
506
		requestor.getResults());	
552
		COMPLETION_PROJECT.setOptions(options);
553
	}
507
}
554
}
508
555
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
509
556
public void testDeprecationCheck12() throws JavaModelException {
510
/**
557
	Map options = COMPLETION_PROJECT.getOptions(true);
511
 * Complete the method call "foobar" from "fooba";
558
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
512
 */
559
	try {
513
public void testCompletionFindMethodInThis() throws JavaModelException {
560
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
514
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
561
		COMPLETION_PROJECT.setOptions(options);
515
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInThis.java");
562
		
516
563
		this.workingCopies = new ICompilationUnit[1];
517
	String str = cu.getSource();
564
		this.workingCopies[0] = getWorkingCopy(
518
	String completeBehind = "fooba";
565
			"/Completion/src/deprecation/Test.java",
519
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
566
			"package deprecation;"+
520
	cu.codeComplete(cursorLocation, requestor);
567
			"public class Test {\n"+
521
	assertEquals(
568
			"  public int bar1;\n"+
522
		"should have one method of 'foobar'", 
569
			"  /** @deprecated */\n"+
523
		"element:foobar    completion:foobar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
570
			"  public int bar2;\n"+
524
		requestor.getResults());		
571
			"  void foo() {"+
572
			"    bar\n"+
573
			"  }"+
574
			"}");
575
	
576
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
577
		String str = this.workingCopies[0].getSource();
578
		String completeBehind = "bar";
579
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
580
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
581
	
582
		assertResults(
583
				"bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
584
				"bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
585
				requestor.getResults());
586
	} finally {
587
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
588
		COMPLETION_PROJECT.setOptions(options);
589
	}
525
}
590
}
526
591
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
527
/**
592
public void testDeprecationCheck13() throws JavaModelException {
528
 * Complete the method call "foobar" from "fooba".  The compilation
593
	Map options = COMPLETION_PROJECT.getOptions(true);
529
 * unit simulates typing in process; ie it has incomplete structure/syntax errors.
594
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
530
 */
595
	try {
531
public void testCompletionFindMethodWhenInProcess() throws JavaModelException {
596
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
532
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
597
		COMPLETION_PROJECT.setOptions(options);
533
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInProcess.java");
598
		
534
599
		this.workingCopies = new ICompilationUnit[1];
535
	String str = cu.getSource();
600
		this.workingCopies[0] = getWorkingCopy(
536
	String completeBehind = "fooba";
601
			"/Completion/src/deprecation/Test.java",
537
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
602
			"package deprecation;"+
538
	cu.codeComplete(cursorLocation, requestor);
603
			"public class Test {\n"+
539
	assertEquals(
604
			"  class Inner1 {}\n"+
540
		"should have a method of 'foobar'", 
605
			"  /** @deprecated */\n"+
541
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
606
			"  class Inner2 {}\n"+
542
		requestor.getResults());
607
			"  void foo() {"+
543
	cu.close();
608
			"    Inn\n"+
609
			"  }"+
610
			"}");
611
	
612
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
613
		String str = this.workingCopies[0].getSource();
614
		String completeBehind = "Inn";
615
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
616
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
617
	
618
		assertResults(
619
				"Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
620
				"Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
621
				requestor.getResults());
622
	} finally {
623
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
624
		COMPLETION_PROJECT.setOptions(options);
625
	}
544
}
626
}
545
627
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
546
public void testCompletionFindSuperInterface() throws JavaModelException {
628
public void testDeprecationCheck14() throws JavaModelException {
547
	this.wc = getWorkingCopy(
629
	Map options = COMPLETION_PROJECT.getOptions(true);
548
            "/Completion/src/CompletionFindSuperInterface.java",
630
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
549
            "public class CompletionFindSuperInterface implements SuperInterface {\n"+
631
	try {
550
            "}");
632
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
551
    
633
		COMPLETION_PROJECT.setOptions(options);
552
    
634
		
553
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
635
		this.workingCopies = new ICompilationUnit[2];
554
    String str = this.wc.getSource();
636
		this.workingCopies[0] = getWorkingCopy(
555
    String completeBehind = "Super";
637
			"/Completion/src/deprecation/Test.java",
556
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
638
			"package deprecation;"+
557
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
639
			"public class Test {\n"+
558
640
			"  class Inner1 {}\n"+
559
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
641
			"  /** @deprecated */\n"+
560
	    assertResults(
642
			"  class Inner2 {}\n"+
561
	           "SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
643
			"  void foo() {"+
644
			"    Inn\n"+
645
			"  }"+
646
			"}");
647
	
648
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
649
		String str = this.workingCopies[0].getSource();
650
		String completeBehind = "Inn";
651
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
652
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
653
	
654
		assertResults(
655
				"Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
656
				"Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
562
				requestor.getResults());
657
				requestor.getResults());
563
    } else {
658
	} finally {
564
    	assertResults(
659
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
565
	            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
660
		COMPLETION_PROJECT.setOptions(options);
566
				"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
661
	}
662
}
663
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
664
public void testDeprecationCheck15() throws JavaModelException {
665
	Map options = COMPLETION_PROJECT.getOptions(true);
666
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
667
	try {
668
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
669
		COMPLETION_PROJECT.setOptions(options);
670
		
671
		this.workingCopies = new ICompilationUnit[2];
672
		this.workingCopies[0] = getWorkingCopy(
673
			"/Completion/src/deprecation/Test.java",
674
			"package deprecation;"+
675
			"public class Test {\n"+
676
			"  void foo() {"+
677
			"    ZZZType1.foo\n"+
678
			"  }"+
679
			"}");
680
		
681
		this.workingCopies[1] = getWorkingCopy(
682
			"/Completion/src/deprecation/ZZZType1.java",
683
			"package deprecation;"+
684
			"/** @deprecated */\n"+
685
			"public class ZZZType1 {\n"+
686
			"  public static int foo1;\n"+
687
			"  public static int foo2;\n"+
688
			"}");
689
	
690
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
691
		String str = this.workingCopies[0].getSource();
692
		String completeBehind = "ZZZType1.foo";
693
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
694
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
695
	
696
		assertResults(
697
				"",
567
				requestor.getResults());
698
				requestor.getResults());
568
    }
699
	} finally {
569
}
700
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
570
701
		COMPLETION_PROJECT.setOptions(options);
571
/**
702
	}
572
 * Complete the field "bar" from "this.ba"
573
 */
574
public void testCompletionFindThisDotField() throws JavaModelException {
575
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
576
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
577
578
	String str = cu.getSource();
579
	String completeBehind = "this.ba";
580
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
581
	cu.codeComplete(cursorLocation, requestor);
582
	assertEquals(
583
		"should have one result of 'bar'", 
584
		"element:bar    completion:bar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
585
		requestor.getResults());
586
}
703
}
587
704
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
588
/**
705
public void testDeprecationCheck16() throws JavaModelException {
589
 * Attempt to do completion with a null requestor
706
	Map options = COMPLETION_PROJECT.getOptions(true);
590
 */
707
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
591
public void testCompletionNullRequestor() throws JavaModelException {
592
	try {
708
	try {
593
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
709
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
594
		cu.codeComplete(5, (CompletionRequestor)null);
710
		COMPLETION_PROJECT.setOptions(options);
595
	} catch (IllegalArgumentException iae) {
711
		
596
		return;
712
		this.workingCopies = new ICompilationUnit[1];
713
		this.workingCopies[0] = getWorkingCopy(
714
			"/Completion/src/deprecation/Test.java",
715
			"package deprecation;"+
716
			"/** @deprecated */\n"+
717
			"public class ZZZType1 {\n"+
718
			"}"+
719
			"public class Test {\n"+
720
			"  void foo() {"+
721
			"    ZZZTy\n"+
722
			"  }"+
723
			"}");
724
	
725
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
726
		String str = this.workingCopies[0].getSource();
727
		String completeBehind = "ZZZTy";
728
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
729
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
730
	
731
		assertResults(
732
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
733
				requestor.getResults());
734
	} finally {
735
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
736
		COMPLETION_PROJECT.setOptions(options);
597
	}
737
	}
598
	assertTrue("Should not be able to do completion with a null requestor", false);
599
}
738
}
600
739
601
/**
740
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127628
602
 * Ensures that the code assist features works on class files with associated source.
741
public void testDeprecationCheck17() throws JavaModelException {
603
 */
742
	Map options = COMPLETION_PROJECT.getOptions(true);
604
public void testCompletionOnClassFile() throws JavaModelException {
743
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
605
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
744
	try {
606
	IClassFile cu = getClassFile("Completion", "zzz.jar", "jarpack1", "X.class");
745
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
746
		COMPLETION_PROJECT.setOptions(options);
747
		
748
		this.workingCopies = new ICompilationUnit[1];
749
		this.workingCopies[0] = getWorkingCopy(
750
			"/Completion/src/deprecation/Test.java",
751
			"package deprecation;"+
752
			"public class Test {\n"+
753
			"  Bug127628Ty\n"+
754
			"}");
607
	
755
	
608
	String str = cu.getSource();
756
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
609
	String completeBehind = "Obj";
757
		String str = this.workingCopies[0].getSource();
610
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
758
		String completeBehind = "Bug127628Ty";
611
	cu.codeComplete(cursorLocation, requestor);
759
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
612
	assertEquals(
760
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
613
		"should have one class", 
761
	
614
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
762
		assertResults(
615
		requestor.getResults());
763
				"Bug127628Ty[POTENTIAL_METHOD_DECLARATION]{Bug127628Ty, Ldeprecation.Test;, ()V, Bug127628Ty, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
764
				"Bug127628Type1.Bug127628TypeInner1[TYPE_REF]{deprecation.Bug127628Type1.Bug127628TypeInner1, deprecation, Ldeprecation.Bug127628Type1$Bug127628TypeInner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
765
				"Bug127628Type2.Bug127628TypeInner2[TYPE_REF]{deprecation.Bug127628Type2.Bug127628TypeInner2, deprecation, Ldeprecation.Bug127628Type2$Bug127628TypeInner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
766
				"Bug127628Type1[TYPE_REF]{Bug127628Type1, deprecation, Ldeprecation.Bug127628Type1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
767
				requestor.getResults());
768
	} finally {
769
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
770
		COMPLETION_PROJECT.setOptions(options);
771
	}
616
}
772
}
617
773
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139937
618
/**
774
public void testEvaluationContextCompletion() throws JavaModelException {
619
 * Test that an out of bounds index causes an exception.
775
	class EvaluationContextCompletionRequestor extends CompletionRequestor {
620
 */
776
		public boolean acceptContext;
621
public void testCompletionOutOfBounds() throws JavaModelException {
777
		public void acceptContext(CompletionContext context) {
622
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
778
			this.acceptContext = context != null;
623
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOutOfBounds.java");
779
		}
624
	try {
780
		public void accept(CompletionProposal proposal) {
625
		cu.codeComplete(cu.getSource().length() + 1, requestor);
781
			// Do nothing
626
	} catch (JavaModelException e) {
782
		}
627
		return;
628
	}
783
	}
629
	assertTrue("should have failed", false);
784
	String start = "";
785
	IJavaProject javaProject = getJavaProject("Completion");
786
	IEvaluationContext context = javaProject.newEvaluationContext();
787
    EvaluationContextCompletionRequestor rc = new EvaluationContextCompletionRequestor();
788
	context.codeComplete(start, start.length(), rc);
789
	
790
	assertTrue("acceptContext() method isn't call", rc.acceptContext);
630
}
791
}
631
792
632
/**
793
/**
633
 * Complete the type "Repeated", "RepeatedOtherType from "Repeated".
794
 * Ensures that completion is not case sensitive
634
 */
795
 */
635
public void testCompletionRepeatedType() throws JavaModelException {
796
public void testCompletionCaseInsensitive() throws JavaModelException {
636
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
797
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
637
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionRepeatedType.java");
798
	ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitive.java");
638
639
	String str = cu.getSource();
640
	String completeBehind = "/**/CompletionRepeated";
641
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
642
	cu.codeComplete(cursorLocation, requestor);
643
	assertEquals(
644
		"should have two types",
645
		"element:CompletionRepeatedOtherType    completion:CompletionRepeatedOtherType    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
646
		"element:CompletionRepeatedType    completion:CompletionRepeatedType    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
647
		requestor.getResults());	
648
}
649
650
651
public void testCompletionVisibilityCheckEnabled() throws JavaModelException {
652
	String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
653
	Hashtable options = JavaCore.getOptions();
654
	Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
655
	options.put(visibilityCheckID,"enabled");
656
	JavaCore.setOptions(options);
657
	
799
	
658
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
659
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
660
661
	String str = cu.getSource();
800
	String str = cu.getSource();
662
	String completeBehind = "x.p";
801
	String completeBehind = "Fiel";
663
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
802
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
664
	cu.codeComplete(cursorLocation, requestor);
803
	cu.codeComplete(cursorLocation, requestor);
665
	
804
	
666
	options.put(visibilityCheckID,visibilityCheckPreviousValue);
805
	assertEquals("should have one class",
667
	JavaCore.setOptions(options);
806
		"element:field    completion:field    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_STATIC + R_NON_RESTRICTED),
668
	assertEquals(
669
		"should have two methods", 
670
		"element:protectedFoo    completion:protectedFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
671
		"element:publicFoo    completion:publicFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
672
		requestor.getResults());
807
		requestor.getResults());
673
}
808
}
674
809
/**
675
810
 * Complete a package in a case insensitive way
676
public void testCompletionVisibilityCheckDisabled() throws JavaModelException {
811
 */
677
	String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
812
public void testCompletionCaseInsensitivePackage() throws JavaModelException {
678
	Hashtable options = JavaCore.getOptions();
679
	Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
680
	options.put(visibilityCheckID,"disabled");
681
	JavaCore.setOptions(options);
682
	
683
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
813
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
684
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
814
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCaseInsensitivePackage.java");
685
815
686
	String str = cu.getSource();
816
	String str = cu.getSource();
687
	String completeBehind = "x.p";
817
	String completeBehind = "Ja";
688
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
818
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
689
	cu.codeComplete(cursorLocation, requestor);
690
	
819
	
691
	options.put(visibilityCheckID,visibilityCheckPreviousValue);
820
	cu.codeComplete(cursorLocation, requestor);
692
	JavaCore.setOptions(options);
693
	assertEquals(
821
	assertEquals(
694
		"should have three methods", 
822
		"should have package completions",
695
		"element:privateFoo    completion:privateFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
823
		"element:jarpack1    completion:jarpack1    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" +
696
		"element:protectedFoo    completion:protectedFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
824
		"element:jarpack2    completion:jarpack2    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED)+"\n" +
697
		"element:publicFoo    completion:publicFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
825
		"element:java    completion:java    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" +
826
		"element:java.io    completion:java.io    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"\n" +
827
		"element:java.lang    completion:java.lang    relevance:"+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED),
698
		requestor.getResults());
828
		requestor.getResults());
699
}
829
}
700
830
701
public void testCompletionAmbiguousFieldName() throws JavaModelException {
831
/**
702
832
 * Complete at end of file.
833
 */
834
public void testCompletionEndOfCompilationUnit() throws JavaModelException {
703
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
835
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
704
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName.java");
836
	ICompilationUnit cu = getCompilationUnit("Completion", "src", "", "CompletionEndOfCompilationUnit.java");
705
837
	cu.codeComplete(cu.getSourceRange().getOffset() + cu.getSourceRange().getLength(), requestor);
706
	String str = cu.getSource();
707
	String completeBehind = "xBa";
708
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
709
	cu.codeComplete(cursorLocation, requestor);
710
711
	assertEquals(
838
	assertEquals(
712
		"should have two completions", 
839
		"should have two methods of 'foo'", 
713
		"element:xBar    completion:this.xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
840
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
714
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
841
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED),
715
		requestor.getResults());
842
		requestor.getResults());	
716
}
843
}
717
844
718
public void testCompletionAmbiguousFieldName2() throws JavaModelException {
845
/**
846
 * Complete the type "A" from "new A".
847
 */
848
public void testCompletionFindClass() throws JavaModelException {
719
	this.wc = getWorkingCopy(
849
	this.wc = getWorkingCopy(
720
            "/Completion/src/CompletionAmbiguousFieldName2.java",
850
            "/Completion/src/CompletionFindClass.java",
721
            "public class CompletionAmbiguousFieldName2 {\n"+
851
            "public class CompletionFindClass {\n" +
722
            "	int xBar;\n"+
852
            "	private    A[] a;\n" +
723
            "	class classFoo {\n"+
853
            "	public CompletionFindClass () {\n" +
724
            "		public void foo(int xBar){\n"+
854
            "		this.a = new A\n" +
725
            "			xBa\n"+
855
            "	}\n" +
726
            "		}\n"+
727
            "	}\n"+
728
            "}");
856
            "}");
729
    
857
    
730
    
858
    
731
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
859
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
732
    String str = this.wc.getSource();
860
    String str = this.wc.getSource();
733
    String completeBehind = "xBa";
861
    String completeBehind = "A";
734
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
862
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
735
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
863
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
736
864
737
    assertResults(
865
    assertResults(
738
            "xBar[FIELD_REF]{CompletionAmbiguousFieldName2.this.xBar, LCompletionAmbiguousFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
866
    		"ABC[TYPE_REF]{p1.ABC, p1, Lp1.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
739
            "xBar[LOCAL_VARIABLE_REF]{xBar, null, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
867
    		"ABC[TYPE_REF]{p2.ABC, p2, Lp2.ABC;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
868
			"A3[TYPE_REF]{A3, , LA3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
869
			"A[TYPE_REF]{A, , LA;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
740
            requestor.getResults());
870
            requestor.getResults());
741
}
871
}
742
872
743
public void testCompletionAmbiguousFieldName3() throws JavaModelException {
873
/**
744
874
 * The same type must be find only once
875
 */
876
public void testCompletionFindClass2() throws JavaModelException {
745
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
877
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
746
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName3.java");
878
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindClass2.java");
747
879
748
	String str = cu.getSource();
880
	String str = cu.getSource();
749
	String completeBehind = "xBa";
881
	String completeBehind = "PX";
750
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
882
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
751
	cu.codeComplete(cursorLocation, requestor);
883
	cu.codeComplete(cursorLocation, requestor);
752
884
753
	assertEquals(
885
	assertEquals(
754
		"should have two completions", 
886
		"should have one classe", 
755
		"element:xBar    completion:ClassFoo.this.xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
887
		"element:PX    completion:pack1.PX    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_QUALIFIED + R_NON_RESTRICTED),
756
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
757
		requestor.getResults());
888
		requestor.getResults());
758
}
889
}
759
890
760
891
761
public void testCompletionAmbiguousFieldName4() throws JavaModelException {
892
/**
762
893
 * Complete the type "Default" in the default package example.
894
 */
895
public void testCompletionFindClassDefaultPackage() throws JavaModelException {
763
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
896
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
764
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName4.java");
897
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionDefaultPackage.java");
765
898
766
	String str = cu.getSource();
899
	String str = cu.getSource();
767
	String completeBehind = "xBa";
900
	String completeBehind = "Def";
768
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
901
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
769
	cu.codeComplete(cursorLocation, requestor);
902
	cu.codeComplete(cursorLocation, requestor);
770
903
771
	assertEquals(
904
	assertEquals(
772
		"should have one completion", 
905
		"should have one class", 
773
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
906
		"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
774
		requestor.getResults());
907
		requestor.getResults());	
775
}
908
}
776
909
777
910
/**
778
public void testCompletionPrefixFieldName1() throws JavaModelException {
911
 * Complete the constructor "CompletionFindConstructor" from "new CompletionFindConstructor(".
912
 */
913
public void testCompletionFindConstructor() throws JavaModelException {
779
	this.wc = getWorkingCopy(
914
	this.wc = getWorkingCopy(
780
            "/Completion/src/CompletionPrefixFieldName1.java",
915
            "/Completion/src/CompletionFindConstructor.java",
781
            "public class CompletionPrefixFieldName1 {\n"+
916
            "public class CompletionFindConstructor {\n"+
782
            "	int xBar;\n"+
917
            "	public CompletionFindConstructor (int i) {\n"+
783
            "	\n"+
784
            "	class classFoo {\n"+
785
            "		int xBar;\n"+
786
            "		\n"+
787
            "		public void foo(){\n"+
788
            "			xBa\n"+
789
            "		}\n"+
790
            "	}\n"+
918
            "	}\n"+
791
            "}");
919
            "	publuc void foo(){\n"+
792
    
920
            "		int x = 45;\n"+
793
    
921
            "		new CompletionFindConstructor(i);\n"+
794
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
795
    String str = this.wc.getSource();
796
    String completeBehind = "xBa";
797
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
798
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
799
800
	assertResults(
801
		"xBar[FIELD_REF]{CompletionPrefixFieldName1.this.xBar, LCompletionPrefixFieldName1;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
802
		"xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName1$classFoo;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
803
		requestor.getResults());
804
}
805
806
807
public void testCompletionPrefixFieldName2() throws JavaModelException {
808
	this.wc = getWorkingCopy(
809
            "/Completion/src/CompletionPrefixFieldName2.java",
810
            "public class CompletionPrefixFieldName2 {\n"+
811
            "	int xBar;\n"+
812
            "	\n"+
813
            "	class classFoo {\n"+
814
            "		int xBar;\n"+
815
            "		\n"+
816
            "		public void foo(){\n"+
817
            "			new CompletionPrefixFieldName2().xBa\n"+
818
            "		}\n"+
819
            "	}\n"+
922
            "	}\n"+
820
            "}");
923
            "}");
821
    
924
    
822
    
925
    
823
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
926
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
824
    String str = this.wc.getSource();
825
    String completeBehind = "xBa";
826
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
827
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
828
829
	assertResults(
830
		"xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
831
		requestor.getResults());
832
}
833
834
835
public void testCompletionPrefixMethodName1() throws JavaModelException {
836
	this.wc = getWorkingCopy(
837
            "/Completion/src/CompletionPrefixMethodName1.java",
838
            "public class CompletionPrefixMethodName1 {\n"+
839
           "	int xBar(){}\n"+
840
           "	\n"+
841
           "	class classFoo {\n"+
842
           "		int xBar(){}\n"+
843
           "		\n"+
844
           "		public void foo(){\n"+
845
           "			xBa\n"+
846
           "		}\n"+
847
           "	}\n"+
848
           "}");
849
    
850
    
927
    
851
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
852
    String str = this.wc.getSource();
928
    String str = this.wc.getSource();
853
    String completeBehind = "xBa";
929
    String completeBehind = "CompletionFindConstructor(";
854
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
930
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
855
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
931
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
856
932
857
	assertResults(
933
    assertResults(
858
		"xBar[METHOD_REF]{CompletionPrefixMethodName1.this.xBar(), LCompletionPrefixMethodName1;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
934
            "expectedTypesSignatures=null\n"+
859
		"xBar[METHOD_REF]{xBar(), LCompletionPrefixMethodName1$classFoo;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
935
            "expectedTypesKeys=null",
860
		requestor.getResults());
936
            requestor.getContext());
937
    
938
   assertResults(
939
			"CompletionFindConstructor[ANONYMOUS_CLASS_DECLARATION]{, LCompletionFindConstructor;, (I)V, null, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
940
			"CompletionFindConstructor[METHOD_REF<CONSTRUCTOR>]{, LCompletionFindConstructor;, (I)V, CompletionFindConstructor, (i), "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}",
941
			requestor.getResults());
861
}
942
}
862
943
863
944
/**
864
public void testCompletionPrefixMethodName2() throws JavaModelException {
945
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
946
 */
947
public void testCompletionFindConstructor2() throws JavaModelException {
865
	this.wc = getWorkingCopy(
948
	this.wc = getWorkingCopy(
866
            "/Completion/src/CompletionPrefixMethodName2.java",
949
            "/Completion/src/CompletionFindConstructor2.java",
867
            "public class CompletionPrefixMethodName2 {\n"+
950
            "import zconstructors.*;\n"+
868
            "	int xBar(){}\n"+
951
            "public class CompletionFindConstructor2 {\n"+
869
            "	\n"+
952
            "	Constructor2 c = new Constructor2();\n"+
870
            "	class classFoo {\n"+
871
            "		int xBar(){}\n"+
872
            "		\n"+
873
            "		public void foo(){\n"+
874
            "			new CompletionPrefixMethodName2().xBa\n"+
875
            "		}\n"+
876
            "	}\n"+
877
            "}");
953
            "}");
878
    
954
    
879
    
955
    
880
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
956
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
957
    
881
    String str = this.wc.getSource();
958
    String str = this.wc.getSource();
882
    String completeBehind = "xBa";
959
    String completeBehind = "Constructor2(";
883
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
960
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
884
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
961
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
885
962
886
	assertResults(
963
    assertResults(
887
		"xBar[METHOD_REF]{xBar(), LCompletionPrefixMethodName2;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
964
            "expectedTypesSignatures=null\n"+
888
		requestor.getResults());
965
            "expectedTypesKeys=null",
966
            requestor.getContext());
967
    
968
    assertEquals(
969
			"Constructor2[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor2;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
970
			"Constructor2[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor2;, ()V, Constructor2, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
971
			requestor.getResults());
889
}
972
}
890
973
891
public void testCompletionPrefixMethodName3() throws JavaModelException {
974
/**
975
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
976
 */
977
public void testCompletionFindConstructor3() throws JavaModelException {
892
	this.wc = getWorkingCopy(
978
	this.wc = getWorkingCopy(
893
            "/Completion/src/CompletionPrefixMethodName2.java",
979
            "/Completion/src/CompletionFindConstructor3.java",
894
            "public class CompletionPrefixMethodName3 {\n"+
980
            "import zconstructors.*;\n"+
895
            "	int xBar(int a, int b){}\n"+
981
            "public class CompletionFindConstructor3 {\n"+
896
            "	\n"+
982
            "	Constructor3 c = new Constructor3();\n"+
897
            "	class classFoo {\n"+
898
            "		int xBar(int a, int b){}\n"+
899
            "		\n"+
900
            "		public void foo(){\n"+
901
            "			xBar(1,\n"+
902
            "		}\n"+
903
            "	}\n"+
904
            "}");
983
            "}");
905
    
984
    
906
    
985
    
907
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
986
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
987
    
908
    String str = this.wc.getSource();
988
    String str = this.wc.getSource();
909
    String completeBehind = "xBar(1,";
989
    String completeBehind = "Constructor3(";
910
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
990
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
911
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
991
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
912
992
913
	assertResults(
993
    assertResults(
914
		"xBar[METHOD_REF]{CompletionPrefixMethodName3.this.xBar(1,, LCompletionPrefixMethodName3;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED)+"}\n"+
994
            "expectedTypesSignatures=null\n"+
915
		"xBar[METHOD_REF]{, LCompletionPrefixMethodName3$classFoo;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
995
            "expectedTypesKeys=null",
916
		requestor.getResults());
996
            requestor.getContext());
997
    
998
    assertEquals(
999
			"Constructor3[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor3;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
1000
			"Constructor3[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor3;, ()V, Constructor3, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
1001
			requestor.getResults());
917
}
1002
}
918
1003
/**
919
public void testCompletionFindMemberType1() throws JavaModelException {
1004
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
1005
 */
1006
public void testCompletionFindConstructor4() throws JavaModelException {
920
	this.wc = getWorkingCopy(
1007
	this.wc = getWorkingCopy(
921
            "/Completion/src/CompletionFindMemberType1.java",
1008
            "/Completion/src/CompletionFindConstructor4.java",
922
            "interface A1 {\n"+
1009
            "import zconstructors.*;\n"+
923
            "	class Inner1 {\n"+
1010
            "public class CompletionFindConstructor4 {\n"+
924
            "	}\n"+
1011
            "	Constructor4 c = new Constructor4();\n"+
925
            "}\n"+
926
            "interface B1 extends A1 {\n"+
927
            "	class Inner1 {\n"+
928
            "	}\n"+
929
            "}\n"+
930
            "public class CompletionFindMemberType1 {\n"+
931
            "	public void foo() {\n"+
932
            "		B1.Inner\n"+
933
            "	}\n"+
934
            "}");
1012
            "}");
935
    
1013
    
936
    
1014
    
937
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1015
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1016
    
938
    String str = this.wc.getSource();
1017
    String str = this.wc.getSource();
939
    String completeBehind = "Inner";
1018
    String completeBehind = "Constructor4(";
940
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1019
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
941
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1020
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
942
1021
943
	assertResults(
1022
    assertResults(
944
		"B1.Inner1[TYPE_REF]{Inner1, , LB1$Inner1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED) +"}",
1023
            "expectedTypesSignatures=null\n"+
945
		requestor.getResults());
1024
            "expectedTypesKeys=null",
1025
            requestor.getContext());
1026
    
1027
	assertEquals(
1028
			"Constructor4[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor4;, (I)V, null, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
1029
			"Constructor4[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor4;, (I)V, Constructor4, (i), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
1030
			requestor.getResults());
946
}
1031
}
947
1032
/**
948
public void testCompletionFindMemberType2() throws JavaModelException {
1033
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78801
949
	this.wc = getWorkingCopy(
1034
 */
950
            "/Completion/src/CompletionPrefixMethodName2.java",
1035
public void testCompletionFindConstructor5() throws JavaModelException {
951
            "interface A2 {\n"+
1036
	this.wc = getWorkingCopy(
952
            "	class ZInner2{\n"+
1037
            "/Completion/src/CompletionFindConstructor5.java",
953
            "	}\n"+
1038
            "import zconstructors.*;\n"+
954
            "}\n"+
1039
            "public class CompletionFindConstructor5 {\n"+
955
            "interface B2 extends A2 {\n"+
1040
            "	Constructor5 c = new Constructor5();\n"+
956
            "	class ZInner2 {\n"+
957
            "	}\n"+
958
            "}\n"+
959
            "public class CompletionFindMemberType2 implements B2{\n"+
960
            "	public void foo() {\n"+
961
            "		ZInner\n"+
962
            "	}\n"+
963
            "}");
1041
            "}");
964
    
1042
    
1043
    
965
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1044
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1045
    
966
    String str = this.wc.getSource();
1046
    String str = this.wc.getSource();
967
    String completeBehind = "ZInner";
1047
    String completeBehind = "Constructor5(";
968
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1048
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
969
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1049
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
970
1050
971
	assertResults(
1051
    assertResults(
972
		"B2.ZInner2[TYPE_REF]{ZInner2, , LB2$ZInner2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1052
            "expectedTypesSignatures=null\n"+
973
		requestor.getResults());
1053
            "expectedTypesKeys=null",
1054
            requestor.getContext());
1055
    
1056
	assertEquals(
1057
			"Constructor5[ANONYMOUS_CLASS_DECLARATION]{, Lzconstructors.Constructor5;, (I)V, null, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
1058
			"Constructor5[METHOD_REF<CONSTRUCTOR>]{, Lzconstructors.Constructor5;, (I)V, Constructor5, (arg0), " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
1059
			requestor.getResults());
974
}
1060
}
1061
/**
1062
 * Complete the exception "Exception" in a catch clause.
1063
 */
1064
public void testCompletionFindExceptions1() throws JavaModelException {
1065
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1066
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException1.java");
975
1067
976
public void testCompletionMethodDeclaration() throws JavaModelException {
1068
	String str = cu.getSource();
1069
	String completeBehind = "Ex";
1070
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1071
	cu.codeComplete(cursorLocation, requestor);
1072
	
1073
	assertEquals(
1074
		"should have one class", 
1075
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED),
1076
		requestor.getResults());
1077
}
977
1078
1079
/**
1080
 * Complete the exception "Exception" in a throws clause.
1081
 */
1082
public void testCompletionFindExceptions2() throws JavaModelException {
978
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1083
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
979
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration.java");
1084
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindException2.java");
980
1085
981
	String str = cu.getSource();
1086
	String str = cu.getSource();
982
	String completeBehind = "eq";
1087
	String completeBehind = "Ex";
983
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1088
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
984
	cu.codeComplete(cursorLocation, requestor);
1089
	cu.codeComplete(cursorLocation, requestor);
985
1090
986
	assertEquals(
1091
	assertEquals(
987
		"should have two completions", 
1092
		"should have one class",
988
		"element:eqFoo    completion:public int eqFoo(int a, Object b)    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"\n" +
1093
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED + R_NON_RESTRICTED),
989
		"element:equals    completion:public boolean equals(Object obj)    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
990
		requestor.getResults());
1094
		requestor.getResults());
991
}
1095
}
992
1096
993
public void testCompletionMethodDeclaration2() throws JavaModelException {
1097
/**
994
	ICompilationUnit superClass = null;
1098
 * Complete the field "var" from "va";
995
	try {
1099
 */
996
		superClass = getWorkingCopy(
1100
public void testCompletionFindField1() throws JavaModelException {
997
	            "/Completion/src/CompletionSuperClass.java",
1101
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
998
	            "public class CompletionSuperClass{\n" +
1102
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField1.java");
999
	            "	public class Inner {}\n" +
1103
1000
	            "	public int eqFoo(int a,Object b){\n" +
1104
	String str = cu.getSource();
1001
	            "		return 1;\n" +
1105
	String completeBehind = "va";
1002
	            "	}\n" +
1106
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1003
	            "}");
1107
	cu.codeComplete(cursorLocation, requestor);
1004
		
1005
		this.wc = getWorkingCopy(
1006
	            "/Completion/src/CompletionMethodDeclaration2.java",
1007
	            "public class CompletionMethodDeclaration2 extends CompletionSuperClass {\n" +
1008
	            "	eq\n" +
1009
	            "}");
1010
	    
1011
	    
1012
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1013
	    String str = this.wc.getSource();
1014
	    String completeBehind = "eq";
1015
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1016
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1017
	
1108
	
1018
		assertResults(
1109
	assertEquals(
1019
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1110
		"should have one field: 'var' and one variable: 'var'", 
1020
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
1111
		"element:var    completion:this.var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n"+
1021
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1112
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
1022
			requestor.getResults());
1113
		requestor.getResults());	
1023
	} finally {
1024
		if(superClass != null) {
1025
			superClass.discardWorkingCopy();
1026
		}
1027
	}
1028
}
1114
}
1029
1115
1030
/**
1116
/**
1031
 * Completion should not propose declarations of method already locally implemented
1117
 * Complete the field "var" from "this.va";
1032
 */
1118
 */
1033
public void testCompletionMethodDeclaration3() throws JavaModelException {
1119
public void testCompletionFindField2() throws JavaModelException {
1034
	ICompilationUnit superClass = null;
1120
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1035
	try {
1121
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField2.java");
1036
		superClass = getWorkingCopy(
1122
1037
	            "/Completion/src/CompletionSuperClass.java",
1123
	String str = cu.getSource();
1038
	            "public class CompletionSuperClass{\n" +
1124
	String completeBehind = "va";
1039
	            "	public class Inner {}\n" +
1125
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1040
	            "	public int eqFoo(int a,Object b){\n" +
1126
	cu.codeComplete(cursorLocation, requestor);
1041
	            "		return 1;\n" +
1042
	            "	}\n" +
1043
	            "}");
1044
		
1045
		this.wc = getWorkingCopy(
1046
	            "/Completion/src/CompletionMethodDeclaration3.java",
1047
	            "public class CompletionMethodDeclaration3 extends CompletionSuperClass {\n" +
1048
	            "	eq\n" +
1049
	            "	\n" +
1050
	            "	public int eqFoo(int a,Object b){\n" +
1051
	            "		return 1;\n" +
1052
	            "	}\n" +
1053
	            "}");
1054
	    
1055
	    
1056
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1057
	    String str = this.wc.getSource();
1058
	    String completeBehind = "eq";
1059
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1060
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1061
	
1127
	
1062
		assertResults(
1128
	assertEquals(
1063
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration3;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1129
		"should have 1 field of starting with 'va'",
1064
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1130
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
1065
			requestor.getResults());
1131
		requestor.getResults());
1066
	} finally {
1067
		if(superClass != null) {
1068
			superClass.discardWorkingCopy();
1069
		}
1070
	}
1071
}
1132
}
1072
1133
1134
public void testCompletionFindField3() throws JavaModelException {
1135
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1136
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindField3.java");
1073
1137
1074
public void testCompletionMethodDeclaration4() throws JavaModelException {
1138
	String str = cu.getSource();
1075
	ICompilationUnit superClass = null;
1139
	String completeBehind = "b.ba";
1076
	try {
1140
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1077
		superClass = getWorkingCopy(
1141
	cu.codeComplete(cursorLocation, requestor);
1078
	            "/Completion/src/CompletionSuperInterface.java",
1142
1079
	            "public interface CompletionSuperInterface{\n"+
1143
	assertEquals(
1080
	            "	public int eqFoo(int a,Object b);\n"+
1144
		"element:bar    completion:bar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED),
1081
	            "}");
1145
		requestor.getResults());
1082
		
1083
		this.wc = getWorkingCopy(
1084
	            "/Completion/src/CompletionMethodDeclaration4.java",
1085
	            "public abstract class CompletionMethodDeclaration4 implements CompletionSuperInterface {\n"+
1086
	            "	eq\n"+
1087
	            "}");
1088
	    
1089
	    
1090
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1091
	    String str = this.wc.getSource();
1092
	    String completeBehind = "eq";
1093
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1094
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1095
	
1096
		assertResults(
1097
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration4;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1098
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1099
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1100
			requestor.getResults());
1101
	} finally {
1102
		if(superClass != null) {
1103
			superClass.discardWorkingCopy();
1104
		}
1105
	}
1106
}
1146
}
1107
1147
1108
public void testCompletionMethodDeclaration5() throws JavaModelException {
1148
/**
1109
	ICompilationUnit superClass = null;
1149
 * Complete the import, "import pac"
1110
	try {
1150
 */
1111
		superClass = getWorkingCopy(
1151
public void testCompletionFindImport1() throws JavaModelException {
1112
	            "/Completion/src/CompletionSuperClass.java",
1152
	this.wc = getWorkingCopy(
1113
	            "public class CompletionSuperClass{\n" +
1153
            "/Completion/src/CompletionFindImport1.java",
1114
	            "	public class Inner {}\n" +
1154
            "import pac\n"+
1115
	            "	public int eqFoo(int a,Object b){\n" +
1155
            "\n"+
1116
	            "		return 1;\n" +
1156
            "public class CompletionFindImport1 {\n"+
1117
	            "	}\n" +
1157
            "\n"+
1118
	            "}");
1158
            "}");
1119
		
1159
    
1120
		this.wc = getWorkingCopy(
1160
    
1121
	            "/Completion/src/CompletionMethodDeclaration5.java",
1161
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1122
	            "public class CompletionMethodDeclaration5 {\n" +
1162
    String str = this.wc.getSource();
1123
	            "	public static void main(String[] args) {\n" +
1163
    String completeBehind = "pac";
1124
	            "		new CompletionSuperClass() {\n" +
1164
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1125
	            "	}\n" +
1165
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1126
	            "\n" +
1166
    
1127
	            "}");
1167
	assertResults(
1128
	    
1168
			"pack[PACKAGE_REF]{pack.*;, pack, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
1129
	    
1169
			"pack1[PACKAGE_REF]{pack1.*;, pack1, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
1130
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1170
			"pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
1131
	    String str = this.wc.getSource();
1171
			"pack2[PACKAGE_REF]{pack2.*;, pack2, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) +"}",
1132
	    String completeBehind = "new CompletionSuperClass() {";
1172
			requestor.getResults());
1133
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1173
}
1134
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1174
1135
	
1175
public void testCompletionFindImport2() throws JavaModelException {
1136
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
1176
	this.wc = getWorkingCopy(
1137
			assertResults(
1177
            "/Completion/src/CompletionFindImport2.java",
1138
				"[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1178
            "import pack1.P\n"+
1139
				"clone[METHOD_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1179
            "\n"+
1140
				"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1180
            "public class CompletionFindImport2 {\n"+
1141
				"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1181
            "\n"+
1142
				"finalize[METHOD_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1182
            "}");
1143
				"hashCode[METHOD_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1183
    
1144
				"toString[METHOD_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}",
1184
    
1145
				requestor.getResults());
1185
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1146
		} else {
1186
    String str = this.wc.getSource();
1147
			assertResults(
1187
    String completeBehind = "pack1.P";
1148
				"[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1188
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1149
				"CompletionMethodDeclaration5[TYPE_REF]{CompletionMethodDeclaration5, , LCompletionMethodDeclaration5;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
1189
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1150
				"clone[METHOD_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1190
    
1151
				"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1191
	assertResults(
1152
				"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1192
			"pack1.pack3[PACKAGE_REF]{pack1.pack3.*;, pack1.pack3, null, null, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+
1153
				"finalize[METHOD_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1193
			"PX[TYPE_REF]{pack1.PX;, pack1, Lpack1.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}",
1154
				"hashCode[METHOD_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1194
			requestor.getResults());
1155
				"toString[METHOD_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}",
1156
				requestor.getResults());
1157
		}
1158
	} finally {
1159
		if(superClass != null) {
1160
			superClass.discardWorkingCopy();
1161
		}
1162
	}
1163
}
1195
}
1164
public void testCompletionMethodDeclaration6() throws JavaModelException {
1165
1196
1197
/**
1198
 * Complete the local variable "var";
1199
 */
1200
public void testCompletionFindLocalVariable() throws JavaModelException {
1166
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1201
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1167
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration6.java");
1202
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindLocalVariable.java");
1168
1203
1169
	String str = cu.getSource();
1204
	String str = cu.getSource();
1170
	String completeBehind = "clon";
1205
	String completeBehind = "va";
1171
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1206
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1172
	cu.codeComplete(cursorLocation, requestor);
1207
	cu.codeComplete(cursorLocation, requestor);
1173
1174
	assertEquals(
1208
	assertEquals(
1175
		"should have one completion", 
1209
		"should have one local variable of 'var'", 
1176
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
1210
		"element:var    completion:var    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED),
1177
		requestor.getResults());
1211
		requestor.getResults());	
1178
}
1212
}
1179
1213
1180
public void testCompletionMethodDeclaration7() throws JavaModelException {
1214
/**
1181
1215
 * Complete the method call "a.foobar" from "a.fooba";
1216
 */
1217
public void testCompletionFindMethod1() throws JavaModelException {
1182
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1218
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1183
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration7.java");
1219
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod1.java");
1184
1220
1185
	String str = cu.getSource();
1221
	String str = cu.getSource();
1186
	String completeBehind = "clon";
1222
	String completeBehind = "fooba";
1187
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1223
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1188
	cu.codeComplete(cursorLocation, requestor);
1224
	cu.codeComplete(cursorLocation, requestor);
1189
1190
	assertEquals(
1225
	assertEquals(
1191
		"should have one completion", 
1226
		"should have two methods of 'foobar'", 
1192
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1227
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
1193
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1228
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
1194
		requestor.getResults());
1229
		requestor.getResults());		
1195
}
1230
}
1196
1231
1197
public void testCompletionMethodDeclaration8() throws JavaModelException {
1198
1232
1233
/**
1234
 * Too much Completion match on interface
1235
 */
1236
public void testCompletionFindMethod2() throws JavaModelException {
1237
	
1199
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1238
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1200
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration8.java");
1239
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethod2.java");
1201
1240
1202
	String str = cu.getSource();
1241
	String str = cu.getSource();
1203
	String completeBehind = "clon";
1242
	String completeBehind = "fooba";
1204
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1243
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1205
	cu.codeComplete(cursorLocation, requestor);
1244
	cu.codeComplete(cursorLocation, requestor);
1206
1245
1207
	assertEquals(
1246
	assertEquals(
1208
		"should have one completion", 
1247
		"should have two completions", 
1209
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1248
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
1210
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1249
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
1211
		requestor.getResults());
1250
		requestor.getResults());	
1212
}
1251
}
1213
1252
1214
public void testCompletionMethodDeclaration9() throws JavaModelException {
1215
1253
1254
/**
1255
 * Complete the method call "foobar" from "fooba";
1256
 */
1257
public void testCompletionFindMethodInThis() throws JavaModelException {
1216
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1258
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1217
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration9.java");
1259
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInThis.java");
1218
1260
1219
	String str = cu.getSource();
1261
	String str = cu.getSource();
1220
	String completeBehind = "clon";
1262
	String completeBehind = "fooba";
1221
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1263
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1222
	cu.codeComplete(cursorLocation, requestor);
1264
	cu.codeComplete(cursorLocation, requestor);
1223
1224
	assertEquals(
1265
	assertEquals(
1225
		"should have one completion", 
1266
		"should have one method of 'foobar'", 
1226
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1267
		"element:foobar    completion:foobar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
1227
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1268
		requestor.getResults());		
1228
		requestor.getResults());
1229
}
1269
}
1230
1270
1231
public void testCompletionMethodDeclaration10() throws JavaModelException {
1271
/**
1232
1272
 * Complete the method call "foobar" from "fooba".  The compilation
1273
 * unit simulates typing in process; ie it has incomplete structure/syntax errors.
1274
 */
1275
public void testCompletionFindMethodWhenInProcess() throws JavaModelException {
1233
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1276
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1234
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration10.java");
1277
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindMethodInProcess.java");
1235
1278
1236
	String str = cu.getSource();
1279
	String str = cu.getSource();
1237
	String completeBehind = "clon";
1280
	String completeBehind = "fooba";
1238
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1281
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1239
	cu.codeComplete(cursorLocation, requestor);
1282
	cu.codeComplete(cursorLocation, requestor);
1240
1241
	assertEquals(
1283
	assertEquals(
1242
		"should have one completion", 
1284
		"should have a method of 'foobar'", 
1243
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1285
		"element:foobar    completion:foobar()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
1244
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1245
		requestor.getResults());
1286
		requestor.getResults());
1287
	cu.close();
1246
}
1288
}
1247
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80063
1248
public void testCompletionMethodDeclaration11() throws JavaModelException {
1249
	this.wc = getWorkingCopy(
1250
			"/Completion/src/test/CompletionMethodDeclaration11.java",
1251
			"package test;\n" +
1252
			"public class CompletionMethodDeclaration11 {\n" +
1253
			"  private void foo() {\n" +
1254
			"  }\n" +
1255
			"}\n" +
1256
			"class CompletionMethodDeclaration11_2 extends CompletionMethodDeclaration11 {\n" +
1257
			"  fo\n" +
1258
			"}");
1259
	
1260
	
1261
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1262
	String str = this.wc.getSource();
1263
	String completeBehind = "fo";
1264
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1265
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1266
1289
1267
	assertResults(
1290
public void testCompletionFindSuperInterface() throws JavaModelException {
1268
			"fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration11_2;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
1291
	this.wc = getWorkingCopy(
1269
			requestor.getResults());
1292
            "/Completion/src/CompletionFindSuperInterface.java",
1270
}
1293
            "public class CompletionFindSuperInterface implements SuperInterface {\n"+
1271
public void testCompletionMethodDeclaration12() throws JavaModelException {
1272
    this.wc = getWorkingCopy(
1273
            "/Completion/src/test/CompletionMethodDeclaration12.java",
1274
            "package test;\n" +
1275
            "public class CompletionMethodDeclaration12 {\n" +
1276
            "  public void foo() {\n" +
1277
            "  }\n" +
1278
            "}\n" +
1279
            "class CompletionMethodDeclaration12_2 extends CompletionMethodDeclaration12{\n" +
1280
            "  public final void foo() {\n" +
1281
            "  }\n" +
1282
            "}\n" +
1283
            "class CompletionMethodDeclaration12_3 extends CompletionMethodDeclaration12_2 {\n" +
1284
            "  fo\n" +
1285
            "}");
1294
            "}");
1286
    
1295
    
1287
    
1296
    
1288
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1297
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1289
    String str = this.wc.getSource();
1298
    String str = this.wc.getSource();
1290
    String completeBehind = "fo";
1299
    String completeBehind = "Super";
1291
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1300
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1292
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1301
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1293
1302
1294
    assertResults(
1303
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
1295
            "fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration12_3;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
1304
	    assertResults(
1296
            requestor.getResults());
1305
	           "SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1306
				requestor.getResults());
1307
    } else {
1308
    	assertResults(
1309
	            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
1310
				"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1311
				requestor.getResults());
1312
    }
1297
}
1313
}
1298
public void testCompletionFieldName() throws JavaModelException {
1314
1315
/**
1316
 * Complete the field "bar" from "this.ba"
1317
 */
1318
public void testCompletionFindThisDotField() throws JavaModelException {
1319
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1320
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
1321
1322
	String str = cu.getSource();
1323
	String completeBehind = "this.ba";
1324
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1325
	cu.codeComplete(cursorLocation, requestor);
1326
	assertEquals(
1327
		"should have one result of 'bar'", 
1328
		"element:bar    completion:bar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED),
1329
		requestor.getResults());
1330
}
1331
1332
/**
1333
 * Attempt to do completion with a null requestor
1334
 */
1335
public void testCompletionNullRequestor() throws JavaModelException {
1336
	try {
1337
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindThisDotField.java");
1338
		cu.codeComplete(5, (CompletionRequestor)null);
1339
	} catch (IllegalArgumentException iae) {
1340
		return;
1341
	}
1342
	assertTrue("Should not be able to do completion with a null requestor", false);
1343
}
1344
1345
/**
1346
 * Ensures that the code assist features works on class files with associated source.
1347
 */
1348
public void testCompletionOnClassFile() throws JavaModelException {
1349
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1350
	IClassFile cu = getClassFile("Completion", "zzz.jar", "jarpack1", "X.class");
1351
	
1352
	String str = cu.getSource();
1353
	String completeBehind = "Obj";
1354
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1355
	cu.codeComplete(cursorLocation, requestor);
1356
	assertEquals(
1357
		"should have one class", 
1358
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
1359
		requestor.getResults());
1360
}
1361
1362
/**
1363
 * Test that an out of bounds index causes an exception.
1364
 */
1365
public void testCompletionOutOfBounds() throws JavaModelException {
1366
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1367
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOutOfBounds.java");
1368
	try {
1369
		cu.codeComplete(cu.getSource().length() + 1, requestor);
1370
	} catch (JavaModelException e) {
1371
		return;
1372
	}
1373
	assertTrue("should have failed", false);
1374
}
1375
1376
/**
1377
 * Complete the type "Repeated", "RepeatedOtherType from "Repeated".
1378
 */
1379
public void testCompletionRepeatedType() throws JavaModelException {
1299
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1380
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1300
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldName.java");
1381
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionRepeatedType.java");
1301
1382
1302
	String str = cu.getSource();
1383
	String str = cu.getSource();
1303
	String completeBehind = "ClassWithComplexName ";
1384
	String completeBehind = "/**/CompletionRepeated";
1304
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1385
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1305
	cu.codeComplete(cursorLocation, requestor);
1386
	cu.codeComplete(cursorLocation, requestor);
1306
1307
	assertEquals(
1387
	assertEquals(
1308
		"should have two completions",
1388
		"should have two types",
1309
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1389
		"element:CompletionRepeatedOtherType    completion:CompletionRepeatedOtherType    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1310
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1390
		"element:CompletionRepeatedType    completion:CompletionRepeatedType    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
1311
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1391
		requestor.getResults());	
1312
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
1313
		requestor.getResults());
1314
}
1392
}
1315
1393
1316
1394
1317
public void testCompletionLocalName() throws JavaModelException {
1395
public void testCompletionVisibilityCheckEnabled() throws JavaModelException {
1396
	String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
1397
	Hashtable options = JavaCore.getOptions();
1398
	Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
1399
	options.put(visibilityCheckID,"enabled");
1400
	JavaCore.setOptions(options);
1401
	
1318
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1402
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1319
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionLocalName.java");
1403
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
1320
1404
1321
	String str = cu.getSource();
1405
	String str = cu.getSource();
1322
	String completeBehind = "ClassWithComplexName ";
1406
	String completeBehind = "x.p";
1323
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1407
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1324
	cu.codeComplete(cursorLocation, requestor);
1408
	cu.codeComplete(cursorLocation, requestor);
1325
1409
	
1410
	options.put(visibilityCheckID,visibilityCheckPreviousValue);
1411
	JavaCore.setOptions(options);
1326
	assertEquals(
1412
	assertEquals(
1327
		"should have two completions", 
1413
		"should have two methods", 
1328
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1414
		"element:protectedFoo    completion:protectedFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
1329
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1415
		"element:publicFoo    completion:publicFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
1330
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1331
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
1332
		requestor.getResults());
1416
		requestor.getResults());
1333
}
1417
}
1334
1418
1335
1419
1336
public void testCompletionArgumentName() throws JavaModelException {
1420
public void testCompletionVisibilityCheckDisabled() throws JavaModelException {
1421
	String visibilityCheckID = "org.eclipse.jdt.core.codeComplete.visibilityCheck";
1422
	Hashtable options = JavaCore.getOptions();
1423
	Object visibilityCheckPreviousValue = options.get(visibilityCheckID);
1424
	options.put(visibilityCheckID,"disabled");
1425
	JavaCore.setOptions(options);
1426
	
1337
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1427
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1338
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArgumentName.java");
1428
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVisibilityCheck.java");
1339
1429
1340
	String str = cu.getSource();
1430
	String str = cu.getSource();
1341
	String completeBehind = "ClassWithComplexName ";
1431
	String completeBehind = "x.p";
1342
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1432
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1343
	cu.codeComplete(cursorLocation, requestor);
1433
	cu.codeComplete(cursorLocation, requestor);
1344
1345
	assertEquals(
1346
		"should have two completions", 
1347
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1348
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1349
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1350
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
1351
		requestor.getResults());
1352
}
1353
1354
1355
public void testCompletionCatchArgumentName() throws JavaModelException {
1356
	this.workingCopies = new ICompilationUnit[1];
1357
	this.workingCopies[0] = getWorkingCopy(
1358
		"/Completion/src/CompletionCatchArgumentName.java",
1359
		"public class CompletionCatchArgumentName {\n"+
1360
		"	public void foo(){\n"+
1361
		"		try{\n"+
1362
		"			\n"+
1363
		"		} catch (Exception ex)\n"+
1364
		"	}\n"+
1365
		"}\n");
1366
	
1367
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1368
	String str = this.workingCopies[0].getSource();
1369
	String completeBehind = "ex";
1370
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1371
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1372
	
1434
	
1373
	assertResults(
1435
	options.put(visibilityCheckID,visibilityCheckPreviousValue);
1374
		"exception[VARIABLE_DECLARATION]{exception, null, Ljava.lang.Exception;, exception, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
1436
	JavaCore.setOptions(options);
1437
	assertEquals(
1438
		"should have three methods", 
1439
		"element:privateFoo    completion:privateFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
1440
		"element:protectedFoo    completion:protectedFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED)+"\n" +
1441
		"element:publicFoo    completion:publicFoo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
1375
		requestor.getResults());
1442
		requestor.getResults());
1376
}
1443
}
1377
1444
1445
public void testCompletionAmbiguousFieldName() throws JavaModelException {
1378
1446
1379
public void testCompletionAmbiguousType() throws JavaModelException {
1380
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1447
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1381
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType.java");
1448
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName.java");
1382
1449
1383
	String str = cu.getSource();
1450
	String str = cu.getSource();
1384
	String completeBehind = "ABC";
1451
	String completeBehind = "xBa";
1385
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1452
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1386
	cu.codeComplete(cursorLocation, requestor);
1453
	cu.codeComplete(cursorLocation, requestor);
1387
1454
1388
	assertEquals(
1455
	assertEquals(
1389
		"should have two completions", 
1456
		"should have two completions", 
1390
		"element:ABC    completion:p1.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n" +
1457
		"element:xBar    completion:this.xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1391
		"element:ABC    completion:p2.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
1458
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
1392
		requestor.getResults());
1459
		requestor.getResults());
1393
}
1460
}
1394
1461
1462
public void testCompletionAmbiguousFieldName2() throws JavaModelException {
1463
	this.wc = getWorkingCopy(
1464
            "/Completion/src/CompletionAmbiguousFieldName2.java",
1465
            "public class CompletionAmbiguousFieldName2 {\n"+
1466
            "	int xBar;\n"+
1467
            "	class classFoo {\n"+
1468
            "		public void foo(int xBar){\n"+
1469
            "			xBa\n"+
1470
            "		}\n"+
1471
            "	}\n"+
1472
            "}");
1473
    
1474
    
1475
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1476
    String str = this.wc.getSource();
1477
    String completeBehind = "xBa";
1478
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1479
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1480
1481
    assertResults(
1482
            "xBar[FIELD_REF]{CompletionAmbiguousFieldName2.this.xBar, LCompletionAmbiguousFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
1483
            "xBar[LOCAL_VARIABLE_REF]{xBar, null, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
1484
            requestor.getResults());
1485
}
1486
1487
public void testCompletionAmbiguousFieldName3() throws JavaModelException {
1395
1488
1396
public void testCompletionAmbiguousType2() throws JavaModelException {
1397
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1489
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1398
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType2.java");
1490
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName3.java");
1399
1491
1400
	String str = cu.getSource();
1492
	String str = cu.getSource();
1401
	String completeBehind = "ABC";
1493
	String completeBehind = "xBa";
1402
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1494
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1403
	cu.codeComplete(cursorLocation, requestor);
1495
	cu.codeComplete(cursorLocation, requestor);
1404
1496
1405
	assertEquals(
1497
	assertEquals(
1406
		"should have two completions", 
1498
		"should have two completions", 
1407
		"element:ABC    completion:ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1499
		"element:xBar    completion:ClassFoo.this.xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
1408
		"element:ABC    completion:p2.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
1500
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
1409
		requestor.getResults());
1501
		requestor.getResults());
1410
}
1502
}
1411
1503
1412
1504
1413
public void testCompletionWithBinaryFolder() throws JavaModelException {
1505
public void testCompletionAmbiguousFieldName4() throws JavaModelException {
1506
1414
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1507
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1415
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionWithBinaryFolder.java");
1508
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousFieldName4.java");
1416
1509
1417
	String str = cu.getSource();
1510
	String str = cu.getSource();
1418
	String completeBehind = "My";
1511
	String completeBehind = "xBa";
1419
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1512
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1420
	cu.codeComplete(cursorLocation, requestor);
1513
	cu.codeComplete(cursorLocation, requestor);
1421
1514
1422
	assertEquals(
1515
	assertEquals(
1423
		"should have two completions",
1516
		"should have one completion", 
1424
		"element:MyClass    completion:MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1517
		"element:xBar    completion:xBar    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
1425
		"element:mypackage    completion:mypackage    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED),
1426
		requestor.getResults());
1518
		requestor.getResults());
1427
}
1519
}
1428
1520
1429
1521
1430
public void testCompletionVariableNameOfArray1() throws JavaModelException {
1522
public void testCompletionPrefixFieldName1() throws JavaModelException {
1431
	this.workingCopies = new ICompilationUnit[1];
1523
	this.wc = getWorkingCopy(
1432
	this.workingCopies[0] = getWorkingCopy(
1524
            "/Completion/src/CompletionPrefixFieldName1.java",
1433
		"/Completion/src/CompletionVariableNameOfArray1.java",
1525
            "public class CompletionPrefixFieldName1 {\n"+
1434
		"public class CompletionVariableNameOfArray1 {\n"+
1526
            "	int xBar;\n"+
1435
		"	Object[] ob\n"+
1527
            "	\n"+
1436
		"}\n");
1528
            "	class classFoo {\n"+
1437
	
1529
            "		int xBar;\n"+
1438
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1530
            "		\n"+
1439
	String str = this.workingCopies[0].getSource();
1531
            "		public void foo(){\n"+
1440
	String completeBehind = "ob";
1532
            "			xBa\n"+
1441
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1533
            "		}\n"+
1442
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1534
            "	}\n"+
1443
	
1535
            "}");
1536
    
1537
    
1538
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1539
    String str = this.wc.getSource();
1540
    String completeBehind = "xBa";
1541
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1542
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1543
1444
	assertResults(
1544
	assertResults(
1445
		"objects[VARIABLE_DECLARATION]{objects, null, [Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
1545
		"xBar[FIELD_REF]{CompletionPrefixFieldName1.this.xBar, LCompletionPrefixFieldName1;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
1546
		"xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName1$classFoo;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
1446
		requestor.getResults());
1547
		requestor.getResults());
1447
}
1548
}
1448
1549
1449
1550
1450
public void testCompletionVariableNameOfArray2() throws JavaModelException {
1551
public void testCompletionPrefixFieldName2() throws JavaModelException {
1451
	this.workingCopies = new ICompilationUnit[1];
1552
	this.wc = getWorkingCopy(
1452
	this.workingCopies[0] = getWorkingCopy(
1553
            "/Completion/src/CompletionPrefixFieldName2.java",
1453
		"/Completion/src/CompletionVariableNameOfArray2.java",
1554
            "public class CompletionPrefixFieldName2 {\n"+
1454
		"public class CompletionVariableNameOfArray2 {\n"+
1555
            "	int xBar;\n"+
1455
		"	Class[] cl\n"+
1556
            "	\n"+
1456
		"}\n");
1557
            "	class classFoo {\n"+
1457
	
1558
            "		int xBar;\n"+
1458
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1559
            "		\n"+
1459
	String str = this.workingCopies[0].getSource();
1560
            "		public void foo(){\n"+
1460
	String completeBehind = "cl";
1561
            "			new CompletionPrefixFieldName2().xBa\n"+
1461
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1562
            "		}\n"+
1462
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1563
            "	}\n"+
1463
	
1564
            "}");
1565
    
1566
    
1567
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1568
    String str = this.wc.getSource();
1569
    String completeBehind = "xBa";
1570
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1571
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1572
1464
	assertResults(
1573
	assertResults(
1465
		"classes[VARIABLE_DECLARATION]{classes, null, [Ljava.lang.Class;, classes, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
1574
		"xBar[FIELD_REF]{xBar, LCompletionPrefixFieldName2;, I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
1466
		requestor.getResults());
1575
		requestor.getResults());
1467
}
1576
}
1468
1577
1469
1578
1470
public void testCompletionVariableNameOfArray3() throws JavaModelException {
1579
public void testCompletionPrefixMethodName1() throws JavaModelException {
1471
	this.workingCopies = new ICompilationUnit[1];
1580
	this.wc = getWorkingCopy(
1472
	this.workingCopies[0] = getWorkingCopy(
1581
            "/Completion/src/CompletionPrefixMethodName1.java",
1473
		"/Completion/src/CompletionVariableNameOfArray3.java",
1582
            "public class CompletionPrefixMethodName1 {\n"+
1474
		"public class CompletionVariableNameOfArray3 {\n"+
1583
           "	int xBar(){}\n"+
1475
		"	Object[][] ob\n"+
1584
           "	\n"+
1476
		"}\n");
1585
           "	class classFoo {\n"+
1477
	
1586
           "		int xBar(){}\n"+
1478
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1587
           "		\n"+
1479
	String str = this.workingCopies[0].getSource();
1588
           "		public void foo(){\n"+
1480
	String completeBehind = "ob";
1589
           "			xBa\n"+
1481
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1590
           "		}\n"+
1482
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1591
           "	}\n"+
1483
	
1592
           "}");
1593
    
1594
    
1595
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1596
    String str = this.wc.getSource();
1597
    String completeBehind = "xBa";
1598
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1599
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1600
1484
	assertResults(
1601
	assertResults(
1485
		"objects[VARIABLE_DECLARATION]{objects, null, [[Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
1602
		"xBar[METHOD_REF]{CompletionPrefixMethodName1.this.xBar(), LCompletionPrefixMethodName1;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
1603
		"xBar[METHOD_REF]{xBar(), LCompletionPrefixMethodName1$classFoo;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
1486
		requestor.getResults());
1604
		requestor.getResults());
1487
}
1605
}
1488
1606
1489
1607
1490
public void testCompletionVariableNameOfArray4() throws JavaModelException {
1608
public void testCompletionPrefixMethodName2() throws JavaModelException {
1491
	this.workingCopies = new ICompilationUnit[1];
1609
	this.wc = getWorkingCopy(
1492
	this.workingCopies[0] = getWorkingCopy(
1610
            "/Completion/src/CompletionPrefixMethodName2.java",
1493
		"/Completion/src/CompletionVariableNameOfArray4.java",
1611
            "public class CompletionPrefixMethodName2 {\n"+
1494
		"public class CompletionVariableNameOfArray4 {\n"+
1612
            "	int xBar(){}\n"+
1495
		"	Objectz[] ob\n"+
1613
            "	\n"+
1496
		"}\n");
1614
            "	class classFoo {\n"+
1497
	
1615
            "		int xBar(){}\n"+
1498
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1616
            "		\n"+
1499
	String str = this.workingCopies[0].getSource();
1617
            "		public void foo(){\n"+
1500
	String completeBehind = "ob";
1618
            "			new CompletionPrefixMethodName2().xBa\n"+
1501
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1619
            "		}\n"+
1502
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1620
            "	}\n"+
1503
	
1621
            "}");
1622
    
1623
    
1624
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1625
    String str = this.wc.getSource();
1626
    String completeBehind = "xBa";
1627
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1628
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1629
1504
	assertResults(
1630
	assertResults(
1505
		"",
1631
		"xBar[METHOD_REF]{xBar(), LCompletionPrefixMethodName2;, ()I, xBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
1506
		requestor.getResults());
1632
		requestor.getResults());
1507
}
1633
}
1508
1634
1635
public void testCompletionPrefixMethodName3() throws JavaModelException {
1636
	this.wc = getWorkingCopy(
1637
            "/Completion/src/CompletionPrefixMethodName2.java",
1638
            "public class CompletionPrefixMethodName3 {\n"+
1639
            "	int xBar(int a, int b){}\n"+
1640
            "	\n"+
1641
            "	class classFoo {\n"+
1642
            "		int xBar(int a, int b){}\n"+
1643
            "		\n"+
1644
            "		public void foo(){\n"+
1645
            "			xBar(1,\n"+
1646
            "		}\n"+
1647
            "	}\n"+
1648
            "}");
1649
    
1650
    
1651
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1652
    String str = this.wc.getSource();
1653
    String completeBehind = "xBar(1,";
1654
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1655
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1509
1656
1510
public void testCompletionVariableNameUnresolvedType() throws JavaModelException {
1657
	assertResults(
1511
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1658
		"xBar[METHOD_REF]{CompletionPrefixMethodName3.this.xBar(1,, LCompletionPrefixMethodName3;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED)+"}\n"+
1512
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameUnresolvedType.java");
1659
		"xBar[METHOD_REF]{, LCompletionPrefixMethodName3$classFoo;, (II)I, xBar, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1513
1514
	String str = cu.getSource();
1515
	String completeBehind = "ob";
1516
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1517
	cu.codeComplete(cursorLocation, requestor);
1518
1519
	assertEquals(
1520
		"should have no completion",
1521
		"",
1522
		requestor.getResults());
1660
		requestor.getResults());
1523
}
1661
}
1524
1662
1525
1663
public void testCompletionFindMemberType1() throws JavaModelException {
1526
public void testCompletionSameSuperClass() throws JavaModelException {
1527
	this.wc = getWorkingCopy(
1664
	this.wc = getWorkingCopy(
1528
            "/Completion/src/CompletionSameSuperClass.java",
1665
            "/Completion/src/CompletionFindMemberType1.java",
1529
            "public class CompletionSameSuperClass extends A {\n" +
1666
            "interface A1 {\n"+
1530
            "	class Inner extends A {\n" +
1667
            "	class Inner1 {\n"+
1531
            "		void foo(int bar){\n" +
1668
            "	}\n"+
1532
            "			bar\n" +
1669
            "}\n"+
1533
            "		}\n" +
1670
            "interface B1 extends A1 {\n"+
1534
            "	}	\n" +
1671
            "	class Inner1 {\n"+
1672
            "	}\n"+
1673
            "}\n"+
1674
            "public class CompletionFindMemberType1 {\n"+
1675
            "	public void foo() {\n"+
1676
            "		B1.Inner\n"+
1677
            "	}\n"+
1535
            "}");
1678
            "}");
1536
    
1679
    
1537
    
1680
    
1538
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1681
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1539
    String str = this.wc.getSource();
1682
    String str = this.wc.getSource();
1540
    String completeBehind = "bar";
1683
    String completeBehind = "Inner";
1541
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1684
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1542
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1685
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1543
1686
1544
	assertResults(
1687
	assertResults(
1545
		"bar[FIELD_REF]{CompletionSameSuperClass.this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
1688
		"B1.Inner1[TYPE_REF]{Inner1, , LB1$Inner1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED) +"}",
1546
		"bar[FIELD_REF]{this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
1547
		"bar[METHOD_REF]{CompletionSameSuperClass.this.bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
1548
		"bar[LOCAL_VARIABLE_REF]{bar, null, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
1549
		"bar[METHOD_REF]{bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1550
		requestor.getResults());
1689
		requestor.getResults());
1551
}
1690
}
1552
1691
1553
public void testCompletionSuperType() throws JavaModelException {
1692
public void testCompletionFindMemberType2() throws JavaModelException {
1554
	ICompilationUnit superClass = null;
1693
	this.wc = getWorkingCopy(
1555
	try {
1694
            "/Completion/src/CompletionPrefixMethodName2.java",
1556
		superClass = getWorkingCopy(
1695
            "interface A2 {\n"+
1557
	            "/Completion/src/CompletionSuperClass.java",
1696
            "	class ZInner2{\n"+
1558
	            "public class CompletionSuperClass{\n" +
1697
            "	}\n"+
1559
	            "	public class Inner {}\n" +
1698
            "}\n"+
1560
	            "	public int eqFoo(int a,Object b){\n" +
1699
            "interface B2 extends A2 {\n"+
1561
	            "		return 1;\n" +
1700
            "	class ZInner2 {\n"+
1562
	            "	}\n" +
1701
            "	}\n"+
1563
	            "}");
1702
            "}\n"+
1564
		
1703
            "public class CompletionFindMemberType2 implements B2{\n"+
1565
		this.wc = getWorkingCopy(
1704
            "	public void foo() {\n"+
1566
	            "/Completion/src/CompletionSuperType.java",
1705
            "		ZInner\n"+
1567
	            "public class CompletionSuperType extends CompletionSuperClass.");
1706
            "	}\n"+
1568
	    
1707
            "}");
1569
	    
1708
    
1570
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1709
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1571
	    String str = this.wc.getSource();
1710
    String str = this.wc.getSource();
1572
	    String completeBehind = "CompletionSuperClass.";
1711
    String completeBehind = "ZInner";
1573
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1712
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1574
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1713
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1575
	
1714
1576
		assertResults(
1715
	assertResults(
1577
			"CompletionSuperClass.Inner[TYPE_REF]{Inner, , LCompletionSuperClass$Inner;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS+ R_NON_RESTRICTED)+"}",
1716
		"B2.ZInner2[TYPE_REF]{ZInner2, , LB2$ZInner2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1578
			requestor.getResults());
1717
		requestor.getResults());
1579
	} finally {
1580
		if(superClass != null) {
1581
			superClass.discardWorkingCopy();
1582
		}
1583
	}
1584
}
1718
}
1585
1719
1586
public void testCompletionSuperType2() throws JavaModelException {
1720
public void testCompletionMethodDeclaration() throws JavaModelException {
1587
	ICompilationUnit superClass = null;
1721
1588
	ICompilationUnit superClass2 = null;
1722
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1589
	ICompilationUnit superInterface = null;
1723
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration.java");
1590
	ICompilationUnit superInterface2 = null;
1724
1591
	try {
1725
	String str = cu.getSource();
1592
		superClass = getWorkingCopy(
1726
	String completeBehind = "eq";
1593
	            "/Completion/src/CompletionSuperClass.java",
1727
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1594
	            "public class CompletionSuperClass{\n" +
1728
	cu.codeComplete(cursorLocation, requestor);
1595
	            "	public class Inner {}\n" +
1729
1596
	            "	public int eqFoo(int a,Object b){\n" +
1730
	assertEquals(
1597
	            "		return 1;\n" +
1731
		"should have two completions", 
1598
	            "	}\n" +
1732
		"element:eqFoo    completion:public int eqFoo(int a, Object b)    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"\n" +
1599
	            "}");
1733
		"element:equals    completion:public boolean equals(Object obj)    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1600
		
1734
		requestor.getResults());
1601
		superClass2 = getWorkingCopy(
1602
	            "/Completion/src/CompletionSuperClass2.java",
1603
	            "public class CompletionSuperClass2 {\n" +
1604
	            "	public class InnerClass {}\n" +
1605
	            "	public interface InnerInterface {}\n" +
1606
	            "}");
1607
		
1608
		superInterface = getWorkingCopy(
1609
	            "/Completion/src/CompletionSuperInterface.java",
1610
	            "public interface CompletionSuperInterface{\n" +
1611
	            "	public int eqFoo(int a,Object b);\n" +
1612
	            "}");
1613
		
1614
		superInterface2 = getWorkingCopy(
1615
	            "/Completion/src/CompletionSuperInterface2.java",
1616
	            "public interface CompletionSuperInterface2 {\n" +
1617
	            "	public class InnerClass {}\n" +
1618
	            "	public interface InnerInterface {}\n" +
1619
	            "}");
1620
		
1621
		this.wc = getWorkingCopy(
1622
	            "/Completion/src/CompletionSuperType2.java",
1623
	            "public class CompletionSuperType2 extends CompletionSuper");
1624
	    
1625
	    
1626
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1627
	    String str = this.wc.getSource();
1628
	    String completeBehind = "CompletionSuper";
1629
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1630
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1631
	
1632
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
1633
			assertResults(
1634
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1635
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1636
				requestor.getResults());
1637
	    } else {
1638
	    	assertResults(
1639
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1640
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1641
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1642
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1643
				requestor.getResults());
1644
	    }
1645
	} finally {
1646
		if(superClass != null) {
1647
			superClass.discardWorkingCopy();
1648
		}
1649
		if(superClass2 != null) {
1650
			superClass2.discardWorkingCopy();
1651
		}
1652
		if(superInterface != null) {
1653
			superInterface.discardWorkingCopy();
1654
		}
1655
		if(superInterface2 != null) {
1656
			superInterface2.discardWorkingCopy();
1657
		}
1658
	}
1659
}
1735
}
1660
1736
1661
public void testCompletionSuperType3() throws JavaModelException {
1737
public void testCompletionMethodDeclaration2() throws JavaModelException {
1662
	ICompilationUnit superClass = null;
1738
	ICompilationUnit superClass = null;
1663
	ICompilationUnit superClass2 = null;
1664
	ICompilationUnit superInterface = null;
1665
	ICompilationUnit superInterface2 = null;
1666
	try {
1739
	try {
1667
		superClass = getWorkingCopy(
1740
		superClass = getWorkingCopy(
1668
	            "/Completion/src/CompletionSuperClass.java",
1741
	            "/Completion/src/CompletionSuperClass.java",
Lines 1673-1807 Link Here
1673
	            "	}\n" +
1746
	            "	}\n" +
1674
	            "}");
1747
	            "}");
1675
		
1748
		
1676
		superClass2 = getWorkingCopy(
1677
	            "/Completion/src/CompletionSuperClass2.java",
1678
	            "public class CompletionSuperClass2 {\n" +
1679
	            "	public class InnerClass {}\n" +
1680
	            "	public interface InnerInterface {}\n" +
1681
	            "}");
1682
		
1683
		superInterface = getWorkingCopy(
1684
	            "/Completion/src/CompletionSuperInterface.java",
1685
	            "public interface CompletionSuperInterface{\n" +
1686
	            "	public int eqFoo(int a,Object b);\n" +
1687
	            "}");
1688
		
1689
		superInterface2 = getWorkingCopy(
1690
	            "/Completion/src/CompletionSuperInterface2.java",
1691
	            "public interface CompletionSuperInterface2 {\n" +
1692
	            "	public class InnerClass {}\n" +
1693
	            "	public interface InnerInterface {}\n" +
1694
	            "}");
1695
		
1696
		this.wc = getWorkingCopy(
1697
	            "/Completion/src/CompletionSuperType3.java",
1698
	            "public class CompletionSuperType3 implements CompletionSuper");
1699
	    
1700
	    
1701
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1702
	    String str = this.wc.getSource();
1703
	    String completeBehind = "CompletionSuper";
1704
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1705
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1706
	
1707
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
1708
			assertResults(
1709
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1710
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1711
				requestor.getResults());
1712
	    } else {
1713
	    	assertResults(
1714
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1715
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1716
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1717
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
1718
				requestor.getResults());
1719
	    }
1720
	} finally {
1721
		if(superClass != null) {
1722
			superClass.discardWorkingCopy();
1723
		}
1724
		if(superClass2 != null) {
1725
			superClass2.discardWorkingCopy();
1726
		}
1727
		if(superInterface != null) {
1728
			superInterface.discardWorkingCopy();
1729
		}
1730
		if(superInterface2 != null) {
1731
			superInterface2.discardWorkingCopy();
1732
		}
1733
	}
1734
}
1735
1736
public void testCompletionSuperType4() throws JavaModelException {
1737
	ICompilationUnit superClass2 = null;
1738
	try {
1739
		superClass2 = getWorkingCopy(
1740
	            "/Completion/src/CompletionSuperClass2.java",
1741
	            "public class CompletionSuperClass2 {\n" +
1742
	            "	public class InnerClass {}\n" +
1743
	            "	public interface InnerInterface {}\n" +
1744
	            "}");
1745
		
1746
		this.wc = getWorkingCopy(
1749
		this.wc = getWorkingCopy(
1747
	            "/Completion/src/CompletionSuperType4.java",
1750
	            "/Completion/src/CompletionMethodDeclaration2.java",
1748
	            "public class CompletionSuperType4 extends CompletionSuperClass2.Inner");
1751
	            "public class CompletionMethodDeclaration2 extends CompletionSuperClass {\n" +
1749
	    
1752
	            "	eq\n" +
1750
	    
1751
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1752
	    String str = this.wc.getSource();
1753
	    String completeBehind = "CompletionSuperClass2.Inner";
1754
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1755
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1756
	
1757
		assertResults(
1758
			"CompletionSuperClass2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperClass2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+ "}\n"+
1759
			"CompletionSuperClass2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperClass2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_NON_RESTRICTED)+"}",
1760
			requestor.getResults());
1761
	} finally {
1762
		if(superClass2 != null) {
1763
			superClass2.discardWorkingCopy();
1764
		}
1765
	}
1766
}
1767
1768
public void testCompletionSuperType5() throws JavaModelException {
1769
	ICompilationUnit superInterface2 = null;
1770
	try {
1771
		superInterface2 = getWorkingCopy(
1772
	            "/Completion/src/CompletionSuperInterface2.java",
1773
	            "public interface CompletionSuperInterface2 {\n" +
1774
	            "	public class InnerClass {}\n" +
1775
	            "	public interface InnerInterface {}\n" +
1776
	            "}");
1753
	            "}");
1777
		
1778
		this.wc = getWorkingCopy(
1779
	            "/Completion/src/CompletionSuperType5.java",
1780
	            "public class CompletionSuperType5 implements CompletionSuperInterface2.Inner");
1781
	    
1754
	    
1782
	    
1755
	    
1783
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1756
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1784
	    String str = this.wc.getSource();
1757
	    String str = this.wc.getSource();
1785
	    String completeBehind = "CompletionSuperInterface2.Inner";
1758
	    String completeBehind = "eq";
1786
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1759
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1787
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1760
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1788
	
1761
	
1789
		assertResults(
1762
		assertResults(
1790
			"CompletionSuperInterface2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperInterface2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
1763
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1791
			"CompletionSuperInterface2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperInterface2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
1764
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
1765
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1792
			requestor.getResults());
1766
			requestor.getResults());
1793
	} finally {
1767
	} finally {
1794
		if(superInterface2 != null) {
1768
		if(superClass != null) {
1795
			superInterface2.discardWorkingCopy();
1769
			superClass.discardWorkingCopy();
1796
		}
1770
		}
1797
	}
1771
	}
1798
}
1772
}
1799
1773
1800
public void testCompletionSuperType6() throws JavaModelException {
1774
/**
1775
 * Completion should not propose declarations of method already locally implemented
1776
 */
1777
public void testCompletionMethodDeclaration3() throws JavaModelException {
1801
	ICompilationUnit superClass = null;
1778
	ICompilationUnit superClass = null;
1802
	ICompilationUnit superClass2 = null;
1803
	ICompilationUnit superInterface = null;
1804
	ICompilationUnit superInterface2 = null;
1805
	try {
1779
	try {
1806
		superClass = getWorkingCopy(
1780
		superClass = getWorkingCopy(
1807
	            "/Completion/src/CompletionSuperClass.java",
1781
	            "/Completion/src/CompletionSuperClass.java",
Lines 1812-3965 Link Here
1812
	            "	}\n" +
1786
	            "	}\n" +
1813
	            "}");
1787
	            "}");
1814
		
1788
		
1815
		superClass2 = getWorkingCopy(
1816
	            "/Completion/src/CompletionSuperClass2.java",
1817
	            "public class CompletionSuperClass2 {\n" +
1818
	            "	public class InnerClass {}\n" +
1819
	            "	public interface InnerInterface {}\n" +
1820
	            "}");
1821
		
1822
		superInterface = getWorkingCopy(
1823
	            "/Completion/src/CompletionSuperInterface.java",
1824
	            "public interface CompletionSuperInterface{\n" +
1825
	            "	public int eqFoo(int a,Object b);\n" +
1826
	            "}");
1827
		
1828
		superInterface2 = getWorkingCopy(
1829
	            "/Completion/src/CompletionSuperInterface2.java",
1830
	            "public interface CompletionSuperInterface2 {\n" +
1831
	            "	public class InnerClass {}\n" +
1832
	            "	public interface InnerInterface {}\n" +
1833
	            "}");
1834
		
1835
		this.wc = getWorkingCopy(
1789
		this.wc = getWorkingCopy(
1836
	            "/Completion/src/CompletionSuperType6.java",
1790
	            "/Completion/src/CompletionMethodDeclaration3.java",
1837
	            "public interface CompletionSuperType6 extends CompletionSuper");
1791
	            "public class CompletionMethodDeclaration3 extends CompletionSuperClass {\n" +
1792
	            "	eq\n" +
1793
	            "	\n" +
1794
	            "	public int eqFoo(int a,Object b){\n" +
1795
	            "		return 1;\n" +
1796
	            "	}\n" +
1797
	            "}");
1838
	    
1798
	    
1839
	    
1799
	    
1840
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1800
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1841
	    String str = this.wc.getSource();
1801
	    String str = this.wc.getSource();
1842
	    String completeBehind = "CompletionSuper";
1802
	    String completeBehind = "eq";
1843
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1803
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1844
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1804
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1845
	
1805
	
1846
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
1806
		assertResults(
1847
			assertResults(
1807
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration3;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1848
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE + R_NON_RESTRICTED)+"}\n" +
1808
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1849
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE+ R_NON_RESTRICTED)+"}",
1809
			requestor.getResults());
1850
				requestor.getResults());
1851
	    } else {
1852
	    	assertResults(
1853
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1854
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
1855
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE + R_NON_RESTRICTED)+"}\n" +
1856
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE+ R_NON_RESTRICTED)+"}",
1857
				requestor.getResults());
1858
	    }
1859
	} finally {
1810
	} finally {
1860
		if(superClass != null) {
1811
		if(superClass != null) {
1861
			superClass.discardWorkingCopy();
1812
			superClass.discardWorkingCopy();
1862
		}
1813
		}
1863
		if(superClass2 != null) {
1864
			superClass2.discardWorkingCopy();
1865
		}
1866
		if(superInterface != null) {
1867
			superInterface.discardWorkingCopy();
1868
		}
1869
		if(superInterface2 != null) {
1870
			superInterface2.discardWorkingCopy();
1871
		}
1872
	}
1814
	}
1873
}
1815
}
1874
1816
1875
public void testCompletionSuperType7() throws JavaModelException {
1817
1876
	ICompilationUnit superClass2 = null;
1818
public void testCompletionMethodDeclaration4() throws JavaModelException {
1819
	ICompilationUnit superClass = null;
1877
	try {
1820
	try {
1878
		superClass2 = getWorkingCopy(
1821
		superClass = getWorkingCopy(
1879
	            "/Completion/src/CompletionSuperClass2.java",
1822
	            "/Completion/src/CompletionSuperInterface.java",
1880
	            "public class CompletionSuperClass2 {\n" +
1823
	            "public interface CompletionSuperInterface{\n"+
1881
	            "	public class InnerClass {}\n" +
1824
	            "	public int eqFoo(int a,Object b);\n"+
1882
	            "	public interface InnerInterface {}\n" +
1883
	            "}");
1825
	            "}");
1884
		
1826
		
1885
		this.wc = getWorkingCopy(
1827
		this.wc = getWorkingCopy(
1886
	            "/Completion/src/CompletionSuperType7.java",
1828
	            "/Completion/src/CompletionMethodDeclaration4.java",
1887
	            "public interface CompletionSuperType7 extends CompletionSuperClass2.Inner");
1829
	            "public abstract class CompletionMethodDeclaration4 implements CompletionSuperInterface {\n"+
1830
	            "	eq\n"+
1831
	            "}");
1888
	    
1832
	    
1889
	    
1833
	    
1890
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1834
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1891
	    String str = this.wc.getSource();
1835
	    String str = this.wc.getSource();
1892
	    String completeBehind = "CompletionSuperClass2.Inner";
1836
	    String completeBehind = "eq";
1893
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1837
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1894
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1838
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1895
	
1839
	
1896
		assertResults(
1840
		assertResults(
1897
			"CompletionSuperClass2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperClass2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
1841
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionMethodDeclaration4;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1898
			"CompletionSuperClass2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperClass2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
1842
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1843
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
1899
			requestor.getResults());
1844
			requestor.getResults());
1900
	} finally {
1845
	} finally {
1901
		if(superClass2 != null) {
1846
		if(superClass != null) {
1902
			superClass2.discardWorkingCopy();
1847
			superClass.discardWorkingCopy();
1903
		}
1848
		}
1904
	}
1849
	}
1905
}
1850
}
1906
1851
1907
public void testCompletionSuperType8() throws JavaModelException {
1852
public void testCompletionMethodDeclaration5() throws JavaModelException {
1908
	ICompilationUnit superInterface2 = null;
1853
	ICompilationUnit superClass = null;
1909
	try {
1854
	try {
1910
		superInterface2 = getWorkingCopy(
1855
		superClass = getWorkingCopy(
1911
	            "/Completion/src/CompletionSuperInterface2.java",
1856
	            "/Completion/src/CompletionSuperClass.java",
1912
	            "public interface CompletionSuperInterface2 {\n" +
1857
	            "public class CompletionSuperClass{\n" +
1913
	            "	public class InnerClass {}\n" +
1858
	            "	public class Inner {}\n" +
1914
	            "	public interface InnerInterface {}\n" +
1859
	            "	public int eqFoo(int a,Object b){\n" +
1860
	            "		return 1;\n" +
1861
	            "	}\n" +
1915
	            "}");
1862
	            "}");
1916
		
1863
		
1917
		this.wc = getWorkingCopy(
1864
		this.wc = getWorkingCopy(
1918
	            "/Completion/src/CompletionSuperType8.java",
1865
	            "/Completion/src/CompletionMethodDeclaration5.java",
1919
	            "public interface CompletionSuperType8 extends CompletionSuperInterface2.Inner");
1866
	            "public class CompletionMethodDeclaration5 {\n" +
1867
	            "	public static void main(String[] args) {\n" +
1868
	            "		new CompletionSuperClass() {\n" +
1869
	            "	}\n" +
1870
	            "\n" +
1871
	            "}");
1920
	    
1872
	    
1921
	    
1873
	    
1922
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1874
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
1923
	    String str = this.wc.getSource();
1875
	    String str = this.wc.getSource();
1924
	    String completeBehind = "CompletionSuperInterface2.Inner";
1876
	    String completeBehind = "new CompletionSuperClass() {";
1925
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1877
	    int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
1926
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1878
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
1927
	
1879
	
1928
		assertResults(
1880
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
1929
			"CompletionSuperInterface2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperInterface2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
1881
			assertResults(
1930
			"CompletionSuperInterface2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperInterface2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
1882
				"[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1931
			requestor.getResults());
1883
				"clone[METHOD_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1884
				"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1885
				"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1886
				"finalize[METHOD_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1887
				"hashCode[METHOD_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1888
				"toString[METHOD_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}",
1889
				requestor.getResults());
1890
		} else {
1891
			assertResults(
1892
				"[POTENTIAL_METHOD_DECLARATION]{, LCompletionSuperClass;, ()V, , null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
1893
				"CompletionMethodDeclaration5[TYPE_REF]{CompletionMethodDeclaration5, , LCompletionMethodDeclaration5;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
1894
				"clone[METHOD_DECLARATION]{protected Object clone() throws CloneNotSupportedException, Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1895
				"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperClass;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1896
				"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1897
				"finalize[METHOD_DECLARATION]{protected void finalize() throws Throwable, Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1898
				"hashCode[METHOD_DECLARATION]{public int hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n"+
1899
				"toString[METHOD_DECLARATION]{public String toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+ "}",
1900
				requestor.getResults());
1901
		}
1932
	} finally {
1902
	} finally {
1933
		if(superInterface2 != null) {
1903
		if(superClass != null) {
1934
			superInterface2.discardWorkingCopy();
1904
			superClass.discardWorkingCopy();
1935
		}
1905
		}
1936
	}
1906
	}
1937
}
1907
}
1908
public void testCompletionMethodDeclaration6() throws JavaModelException {
1938
1909
1939
public void testCompletionMethodThrowsClause() throws JavaModelException {
1940
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1910
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1941
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause.java");
1911
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration6.java");
1942
1912
1943
	String str = cu.getSource();
1913
	String str = cu.getSource();
1944
	String completeBehind = "Ex";
1914
	String completeBehind = "clon";
1945
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1915
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1946
	cu.codeComplete(cursorLocation, requestor);
1916
	cu.codeComplete(cursorLocation, requestor);
1947
1917
1948
	assertEquals(
1918
	assertEquals(
1949
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED),
1919
		"should have one completion", 
1920
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
1950
		requestor.getResults());
1921
		requestor.getResults());
1951
}
1922
}
1952
1923
1953
public void testCompletionMethodThrowsClause2() throws JavaModelException {
1924
public void testCompletionMethodDeclaration7() throws JavaModelException {
1954
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1955
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause2.java");
1956
1957
	String str = cu.getSource();
1958
	String completeBehind = "Ex";
1959
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1960
	cu.codeComplete(cursorLocation, requestor);
1961
1962
	assertEquals(
1963
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_NON_RESTRICTED),
1964
		requestor.getResults());
1965
}
1966
1925
1967
public void testCompletionThrowStatement() throws JavaModelException {
1968
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1926
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1969
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionThrowStatement.java");
1927
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration7.java");
1970
1928
1971
	String str = cu.getSource();
1929
	String str = cu.getSource();
1972
	String completeBehind = "Ex";
1930
	String completeBehind = "clon";
1973
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1931
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1974
	cu.codeComplete(cursorLocation, requestor);
1932
	cu.codeComplete(cursorLocation, requestor);
1975
1933
1976
	assertEquals(
1934
	assertEquals(
1977
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED),
1935
		"should have one completion", 
1936
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1937
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
1978
		requestor.getResults());
1938
		requestor.getResults());
1979
}
1939
}
1980
1940
1981
public void testCompletionUnresolvedReturnType() throws JavaModelException {
1941
public void testCompletionMethodDeclaration8() throws JavaModelException {
1982
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1983
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedReturnType.java");
1984
1985
	String str = cu.getSource();
1986
	String completeBehind = "bar";
1987
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1988
	cu.codeComplete(cursorLocation, requestor);
1989
1990
	assertEquals(
1991
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
1992
		requestor.getResults());
1993
}
1994
1942
1995
public void testCompletionUnresolvedParameterType() throws JavaModelException {
1996
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1943
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1997
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedParameterType.java");
1944
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration8.java");
1998
1945
1999
	String str = cu.getSource();
1946
	String str = cu.getSource();
2000
	String completeBehind = "bar";
1947
	String completeBehind = "clon";
2001
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1948
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2002
	cu.codeComplete(cursorLocation, requestor);
1949
	cu.codeComplete(cursorLocation, requestor);
2003
1950
2004
	assertEquals(
1951
	assertEquals(
2005
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
1952
		"should have one completion", 
1953
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1954
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
2006
		requestor.getResults());
1955
		requestor.getResults());
2007
}
1956
}
2008
1957
2009
public void testCompletionUnresolvedFieldType() throws JavaModelException {
1958
public void testCompletionMethodDeclaration9() throws JavaModelException {
1959
2010
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1960
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2011
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedFieldType.java");
1961
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration9.java");
2012
1962
2013
	String str = cu.getSource();
1963
	String str = cu.getSource();
2014
	String completeBehind = "bar";
1964
	String completeBehind = "clon";
2015
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1965
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2016
	cu.codeComplete(cursorLocation, requestor);
1966
	cu.codeComplete(cursorLocation, requestor);
2017
1967
2018
	assertEquals(
1968
	assertEquals(
2019
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
1969
		"should have one completion", 
1970
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
1971
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
2020
		requestor.getResults());
1972
		requestor.getResults());
2021
}
1973
}
2022
/*
2023
 * bug : http://dev.eclipse.org/bugs/show_bug.cgi?id=24440
2024
 */
2025
public void testCompletionUnresolvedEnclosingType() throws JavaModelException {
2026
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2027
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedEnclosingType.java");
2028
1974
2029
	String str = cu.getSource();
1975
public void testCompletionMethodDeclaration10() throws JavaModelException {
2030
	String completeBehind = "new ZZZ(";
2031
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2032
	cu.codeComplete(cursorLocation, requestor);
2033
1976
2034
	assertTrue(
2035
		requestor.getResults().length() == 0);
2036
}
2037
public void testCompletionReturnStatementIsParent1() throws JavaModelException {
2038
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1977
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2039
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent1.java");
1978
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodDeclaration10.java");
2040
1979
2041
	String str = cu.getSource();
1980
	String str = cu.getSource();
2042
	String completeBehind = "zz";
1981
	String completeBehind = "clon";
2043
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1982
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2044
	cu.codeComplete(cursorLocation, requestor);
1983
	cu.codeComplete(cursorLocation, requestor);
2045
1984
2046
	assertEquals(
1985
	assertEquals(
2047
		"element:zz00    completion:zz00    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1986
		"should have one completion", 
2048
		"element:zz00M    completion:zz00M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1987
		"element:CloneNotSupportedException    completion:CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
2049
		"element:zz01    completion:zz01    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
1988
		"element:clone    completion:protected Object clone() throws CloneNotSupportedException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
2050
		"element:zz01M    completion:zz01M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2051
		"element:zz02    completion:zz02    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2052
		"element:zz02M    completion:zz02M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2053
		"element:zz10    completion:zz10    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2054
		"element:zz10M    completion:zz10M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2055
		"element:zz11    completion:zz11    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2056
		"element:zz11M    completion:zz11M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2057
		"element:zz12    completion:zz12    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2058
		"element:zz12M    completion:zz12M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2059
		"element:zz20    completion:zz20    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2060
		"element:zz20M    completion:zz20M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2061
		"element:zz21    completion:zz21    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2062
		"element:zz21M    completion:zz21M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2063
		"element:zz22    completion:zz22    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2064
		"element:zz22M    completion:zz22M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2065
		"element:zzOb    completion:zzOb    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2066
		"element:zzObM    completion:zzObM()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2067
		requestor.getResults());
1989
		requestor.getResults());
2068
}
1990
}
2069
1991
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80063
2070
public void testCompletionReturnStatementIsParent2() throws JavaModelException {
1992
public void testCompletionMethodDeclaration11() throws JavaModelException {
2071
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
1993
	this.wc = getWorkingCopy(
2072
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent2.java");
1994
			"/Completion/src/test/CompletionMethodDeclaration11.java",
2073
1995
			"package test;\n" +
2074
	String str = cu.getSource();
1996
			"public class CompletionMethodDeclaration11 {\n" +
2075
	String completeBehind = "xx";
1997
			"  private void foo() {\n" +
1998
			"  }\n" +
1999
			"}\n" +
2000
			"class CompletionMethodDeclaration11_2 extends CompletionMethodDeclaration11 {\n" +
2001
			"  fo\n" +
2002
			"}");
2003
	
2004
	
2005
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2006
	String str = this.wc.getSource();
2007
	String completeBehind = "fo";
2076
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2008
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2077
	cu.codeComplete(cursorLocation, requestor);
2009
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2078
2010
2079
	assertEquals(
2011
	assertResults(
2080
		"element:XX00    completion:XX00    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2012
			"fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration11_2;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
2081
		"element:XX01    completion:XX01    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2013
			requestor.getResults());
2082
		"element:XX02    completion:XX02    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2083
		"element:XX10    completion:XX10    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2084
		"element:XX11    completion:XX11    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2085
		"element:XX12    completion:XX12    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2086
		"element:XX20    completion:XX20    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2087
		"element:XX21    completion:XX21    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2088
		"element:XX22    completion:XX22    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
2089
		requestor.getResults());
2090
}
2014
}
2015
public void testCompletionMethodDeclaration12() throws JavaModelException {
2016
    this.wc = getWorkingCopy(
2017
            "/Completion/src/test/CompletionMethodDeclaration12.java",
2018
            "package test;\n" +
2019
            "public class CompletionMethodDeclaration12 {\n" +
2020
            "  public void foo() {\n" +
2021
            "  }\n" +
2022
            "}\n" +
2023
            "class CompletionMethodDeclaration12_2 extends CompletionMethodDeclaration12{\n" +
2024
            "  public final void foo() {\n" +
2025
            "  }\n" +
2026
            "}\n" +
2027
            "class CompletionMethodDeclaration12_3 extends CompletionMethodDeclaration12_2 {\n" +
2028
            "  fo\n" +
2029
            "}");
2030
    
2031
    
2032
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2033
    String str = this.wc.getSource();
2034
    String completeBehind = "fo";
2035
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2036
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2091
2037
2092
public void testCompletionCastIsParent1() throws JavaModelException {
2038
    assertResults(
2093
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2039
            "fo[POTENTIAL_METHOD_DECLARATION]{fo, Ltest.CompletionMethodDeclaration12_3;, ()V, fo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
2094
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent1.java");
2040
            requestor.getResults());
2095
2096
	String str = cu.getSource();
2097
	String completeBehind = "zz";
2098
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2099
	cu.codeComplete(cursorLocation, requestor);
2100
2101
	assertEquals(
2102
		"element:zz00    completion:zz00    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2103
		"element:zz00M    completion:zz00M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2104
		"element:zz01    completion:zz01    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2105
		"element:zz01M    completion:zz01M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2106
		"element:zz02    completion:zz02    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2107
		"element:zz02M    completion:zz02M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2108
		"element:zz10    completion:zz10    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2109
		"element:zz10M    completion:zz10M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2110
		"element:zz11    completion:zz11    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2111
		"element:zz11M    completion:zz11M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2112
		"element:zz12    completion:zz12    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2113
		"element:zz12M    completion:zz12M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2114
		"element:zz20    completion:zz20    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2115
		"element:zz20M    completion:zz20M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2116
		"element:zz21    completion:zz21    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2117
		"element:zz21M    completion:zz21M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2118
		"element:zz22    completion:zz22    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2119
		"element:zz22M    completion:zz22M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2120
		"element:zzOb    completion:zzOb    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2121
		"element:zzObM    completion:zzObM()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2122
		requestor.getResults());
2123
}
2041
}
2124
2042
public void testCompletionFieldName() throws JavaModelException {
2125
public void testCompletionCastIsParent2() throws JavaModelException {
2126
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2043
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2127
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent2.java");
2044
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldName.java");
2128
2045
2129
	String str = cu.getSource();
2046
	String str = cu.getSource();
2130
	String completeBehind = "xx";
2047
	String completeBehind = "ClassWithComplexName ";
2131
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2048
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2132
	cu.codeComplete(cursorLocation, requestor);
2049
	cu.codeComplete(cursorLocation, requestor);
2133
2050
2134
	assertEquals(
2051
	assertEquals(
2135
		"element:XX00    completion:XX00    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2052
		"should have two completions",
2136
		"element:XX01    completion:XX01    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2053
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2137
		"element:XX02    completion:XX02    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2054
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2138
		"element:XX10    completion:XX10    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2055
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2139
		"element:XX11    completion:XX11    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2056
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
2140
		"element:XX12    completion:XX12    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2141
		"element:XX20    completion:XX20    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2142
		"element:XX21    completion:XX21    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2143
		"element:XX22    completion:XX22    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
2144
		requestor.getResults());
2057
		requestor.getResults());
2145
}
2058
}
2146
2059
2147
public void testCompletionMessageSendIsParent1() throws JavaModelException {
2060
2061
public void testCompletionLocalName() throws JavaModelException {
2148
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2062
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2149
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent1.java");
2063
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionLocalName.java");
2150
2064
2151
	String str = cu.getSource();
2065
	String str = cu.getSource();
2152
	String completeBehind = "zz";
2066
	String completeBehind = "ClassWithComplexName ";
2153
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2067
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2154
	cu.codeComplete(cursorLocation, requestor);
2068
	cu.codeComplete(cursorLocation, requestor);
2155
2069
2156
	assertEquals(
2070
	assertEquals(
2157
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2071
		"should have two completions", 
2158
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2072
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2159
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2073
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2160
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2074
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2161
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2075
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
2162
		requestor.getResults());
2076
		requestor.getResults());
2163
}
2077
}
2164
2078
2165
public void testCompletionMessageSendIsParent2() throws JavaModelException {
2079
2080
public void testCompletionArgumentName() throws JavaModelException {
2166
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2081
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2167
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent2.java");
2082
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArgumentName.java");
2168
2083
2169
	String str = cu.getSource();
2084
	String str = cu.getSource();
2170
	String completeBehind = "zz";
2085
	String completeBehind = "ClassWithComplexName ";
2171
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2086
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2172
	cu.codeComplete(cursorLocation, requestor);
2087
	cu.codeComplete(cursorLocation, requestor);
2173
2088
2174
	assertEquals(
2089
	assertEquals(
2175
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2090
		"should have two completions", 
2176
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2091
		"element:classWithComplexName    completion:classWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2177
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2092
		"element:complexName2    completion:complexName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2178
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2093
		"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2179
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2094
		"element:withComplexName    completion:withComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
2180
		requestor.getResults());
2095
		requestor.getResults());
2181
}
2096
}
2182
2097
2183
public void testCompletionMessageSendIsParent3() throws JavaModelException {
2184
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2185
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent3.java");
2186
2098
2187
	String str = cu.getSource();
2099
public void testCompletionCatchArgumentName() throws JavaModelException {
2188
	String completeBehind = "zz";
2100
	this.workingCopies = new ICompilationUnit[1];
2101
	this.workingCopies[0] = getWorkingCopy(
2102
		"/Completion/src/CompletionCatchArgumentName.java",
2103
		"public class CompletionCatchArgumentName {\n"+
2104
		"	public void foo(){\n"+
2105
		"		try{\n"+
2106
		"			\n"+
2107
		"		} catch (Exception ex)\n"+
2108
		"	}\n"+
2109
		"}\n");
2110
	
2111
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2112
	String str = this.workingCopies[0].getSource();
2113
	String completeBehind = "ex";
2189
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2114
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2190
	cu.codeComplete(cursorLocation, requestor);
2115
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2191
2116
	
2192
	assertEquals(
2117
	assertResults(
2193
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2118
		"exception[VARIABLE_DECLARATION]{exception, null, Ljava.lang.Exception;, exception, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
2194
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2195
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2196
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2197
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2198
		requestor.getResults());
2119
		requestor.getResults());
2199
}
2120
}
2200
2121
2201
public void testCompletionMessageSendIsParent4() throws JavaModelException {
2122
2123
public void testCompletionAmbiguousType() throws JavaModelException {
2202
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2124
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2203
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent4.java");
2125
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType.java");
2204
2126
2205
	String str = cu.getSource();
2127
	String str = cu.getSource();
2206
	String completeBehind = "zz";
2128
	String completeBehind = "ABC";
2207
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2129
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2208
	cu.codeComplete(cursorLocation, requestor);
2130
	cu.codeComplete(cursorLocation, requestor);
2209
2131
2210
	assertEquals(
2132
	assertEquals(
2211
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2133
		"should have two completions", 
2212
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2134
		"element:ABC    completion:p1.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n" +
2213
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2135
		"element:ABC    completion:p2.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
2214
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2215
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2216
		requestor.getResults());
2136
		requestor.getResults());
2217
}
2137
}
2218
2138
2219
public void testCompletionMessageSendIsParent5() throws JavaModelException {
2139
2140
public void testCompletionAmbiguousType2() throws JavaModelException {
2220
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2141
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2221
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent5.java");
2142
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAmbiguousType2.java");
2222
2143
2223
	String str = cu.getSource();
2144
	String str = cu.getSource();
2224
	String completeBehind = "zz";
2145
	String completeBehind = "ABC";
2225
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2146
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2226
	cu.codeComplete(cursorLocation, requestor);
2147
	cu.codeComplete(cursorLocation, requestor);
2227
2148
2228
	assertEquals(
2149
	assertEquals(
2229
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2150
		"should have two completions", 
2230
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2151
		"element:ABC    completion:ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2231
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2152
		"element:ABC    completion:p2.ABC    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
2232
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2233
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2234
		requestor.getResults());
2153
		requestor.getResults());
2235
}
2154
}
2236
2155
2237
public void testCompletionMessageSendIsParent6() throws JavaModelException {
2156
2157
public void testCompletionWithBinaryFolder() throws JavaModelException {
2238
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2158
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2239
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent6.java");
2159
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionWithBinaryFolder.java");
2240
2160
2241
	String str = cu.getSource();
2161
	String str = cu.getSource();
2242
	String completeBehind = "zz";
2162
	String completeBehind = "My";
2243
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2163
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2244
	cu.codeComplete(cursorLocation, requestor);
2164
	cu.codeComplete(cursorLocation, requestor);
2245
2165
2246
	assertEquals(
2166
	assertEquals(
2247
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2167
		"should have two completions",
2248
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2168
		"element:MyClass    completion:MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2249
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2169
		"element:mypackage    completion:mypackage    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED),
2250
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2251
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2252
		requestor.getResults());
2170
		requestor.getResults());
2253
}
2171
}
2254
2172
2255
public void testCompletionAllocationExpressionIsParent1() throws JavaModelException {
2256
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2257
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent1.java");
2258
2173
2259
	String str = cu.getSource();
2174
public void testCompletionVariableNameOfArray1() throws JavaModelException {
2260
	String completeBehind = "zz";
2175
	this.workingCopies = new ICompilationUnit[1];
2176
	this.workingCopies[0] = getWorkingCopy(
2177
		"/Completion/src/CompletionVariableNameOfArray1.java",
2178
		"public class CompletionVariableNameOfArray1 {\n"+
2179
		"	Object[] ob\n"+
2180
		"}\n");
2181
	
2182
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2183
	String str = this.workingCopies[0].getSource();
2184
	String completeBehind = "ob";
2261
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2185
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2262
	cu.codeComplete(cursorLocation, requestor);
2186
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2263
2187
	
2264
	assertEquals(
2188
	assertResults(
2265
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2189
		"objects[VARIABLE_DECLARATION]{objects, null, [Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
2266
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2267
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2268
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2269
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2270
		requestor.getResults());
2190
		requestor.getResults());
2271
}
2191
}
2272
2192
2273
public void testCompletionAllocationExpressionIsParent2() throws JavaModelException {
2274
	this.wc = getWorkingCopy(
2275
            "/Completion/src/CompletionAllocationExpressionIsParent2.java",
2276
            "public class CompletionAllocationExpressionIsParent2 {\n" +
2277
            "	public class Inner {\n" +
2278
            "		public Inner(long i, long j){super();}\n" +
2279
            "		public Inner(Object i, Object j){super();}\n" +
2280
            "		\n" +
2281
            "	}\n" +
2282
            "	\n" +
2283
            "	long zzlong;\n" +
2284
            "	int zzint;\n" +
2285
            "	double zzdouble;\n" +
2286
            "	boolean zzboolean;\n" +
2287
            "	Object zzObject;\n" +
2288
            "	\n" +
2289
            "	void foo() {\n" +
2290
            "		this.new Inner(1, zz\n" +
2291
            "	}\n" +
2292
            "}");
2293
    
2294
    
2295
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2296
    String str = this.wc.getSource();
2297
    String completeBehind = "zz";
2298
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2299
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2300
2193
2301
    assertResults(
2194
public void testCompletionVariableNameOfArray2() throws JavaModelException {
2302
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent2;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2195
	this.workingCopies = new ICompilationUnit[1];
2303
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent2;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2196
	this.workingCopies[0] = getWorkingCopy(
2304
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent2;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2197
		"/Completion/src/CompletionVariableNameOfArray2.java",
2305
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent2;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2198
		"public class CompletionVariableNameOfArray2 {\n"+
2306
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent2;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
2199
		"	Class[] cl\n"+
2307
            requestor.getResults());
2200
		"}\n");
2201
	
2202
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2203
	String str = this.workingCopies[0].getSource();
2204
	String completeBehind = "cl";
2205
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2206
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2207
	
2208
	assertResults(
2209
		"classes[VARIABLE_DECLARATION]{classes, null, [Ljava.lang.Class;, classes, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
2210
		requestor.getResults());
2308
}
2211
}
2309
2212
2310
public void testCompletionAllocationExpressionIsParent3() throws JavaModelException {
2311
	this.wc = getWorkingCopy(
2312
            "/Completion/src/CompletionAllocationExpressionIsParent3.java",
2313
            "public class CompletionAllocationExpressionIsParent3 {\n" +
2314
            "	public class Inner {\n" +
2315
            "		public Inner(long i, long j){super();}\n" +
2316
            "		public Inner(Object i, Object j){super();}\n" +
2317
            "		\n" +
2318
            "	}\n" +
2319
            "	\n" +
2320
            "	long zzlong;\n" +
2321
            "	int zzint;\n" +
2322
            "	double zzdouble;\n" +
2323
            "	boolean zzboolean;\n" +
2324
            "	Object zzObject;\n" +
2325
            "	\n" +
2326
            "	void foo() {\n" +
2327
            "		new CompletionAllocationExpressionIsParent3().new Inner(1, zz\n" +
2328
            "	}\n" +
2329
            "}");
2330
    
2331
    
2332
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2333
    String str = this.wc.getSource();
2334
    String completeBehind = "zz";
2335
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2336
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2337
2213
2338
    assertResults(
2214
public void testCompletionVariableNameOfArray3() throws JavaModelException {
2339
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent3;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2215
	this.workingCopies = new ICompilationUnit[1];
2340
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent3;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2216
	this.workingCopies[0] = getWorkingCopy(
2341
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent3;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2217
		"/Completion/src/CompletionVariableNameOfArray3.java",
2342
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent3;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2218
		"public class CompletionVariableNameOfArray3 {\n"+
2343
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent3;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
2219
		"	Object[][] ob\n"+
2344
            requestor.getResults());
2220
		"}\n");
2221
	
2222
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2223
	String str = this.workingCopies[0].getSource();
2224
	String completeBehind = "ob";
2225
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2226
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2227
	
2228
	assertResults(
2229
		"objects[VARIABLE_DECLARATION]{objects, null, [[Ljava.lang.Object;, objects, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
2230
		requestor.getResults());
2345
}
2231
}
2346
2232
2347
public void testCompletionAllocationExpressionIsParent4() throws JavaModelException {
2348
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2349
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent4.java");
2350
2233
2351
	String str = cu.getSource();
2234
public void testCompletionVariableNameOfArray4() throws JavaModelException {
2352
	String completeBehind = "zz";
2235
	this.workingCopies = new ICompilationUnit[1];
2236
	this.workingCopies[0] = getWorkingCopy(
2237
		"/Completion/src/CompletionVariableNameOfArray4.java",
2238
		"public class CompletionVariableNameOfArray4 {\n"+
2239
		"	Objectz[] ob\n"+
2240
		"}\n");
2241
	
2242
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2243
	String str = this.workingCopies[0].getSource();
2244
	String completeBehind = "ob";
2353
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2245
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2354
	cu.codeComplete(cursorLocation, requestor);
2246
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2355
2247
	
2356
	assertEquals(
2248
	assertResults(
2357
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2249
		"",
2358
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2359
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2360
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2361
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2362
		requestor.getResults());
2250
		requestor.getResults());
2363
}
2251
}
2364
2252
2365
public void testCompletionAllocationExpressionIsParent5() throws JavaModelException {
2253
2254
public void testCompletionVariableNameUnresolvedType() throws JavaModelException {
2366
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2255
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2367
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent5.java");
2256
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableNameUnresolvedType.java");
2368
2257
2369
	String str = cu.getSource();
2258
	String str = cu.getSource();
2370
	String completeBehind = "zz";
2259
	String completeBehind = "ob";
2371
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2260
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2372
	cu.codeComplete(cursorLocation, requestor);
2261
	cu.codeComplete(cursorLocation, requestor);
2373
2262
2374
	assertEquals(
2263
	assertEquals(
2375
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2264
		"should have no completion",
2376
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2265
		"",
2377
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2378
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2379
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2380
		requestor.getResults());
2266
		requestor.getResults());
2381
}
2267
}
2382
2268
2383
public void testCompletionAllocationExpressionIsParent6() throws JavaModelException {
2269
2270
public void testCompletionSameSuperClass() throws JavaModelException {
2384
	this.wc = getWorkingCopy(
2271
	this.wc = getWorkingCopy(
2385
            "/Completion/src/CompletionAllocationExpressionIsParent6.java",
2272
            "/Completion/src/CompletionSameSuperClass.java",
2386
            "public class CompletionAllocationExpressionIsParent6 {\n" +
2273
            "public class CompletionSameSuperClass extends A {\n" +
2387
            "	\n" +
2274
            "	class Inner extends A {\n" +
2388
            "	long zzlong;\n" +
2275
            "		void foo(int bar){\n" +
2389
            "	int zzint;\n" +
2276
            "			bar\n" +
2390
            "	double zzdouble;\n" +
2277
            "		}\n" +
2391
            "	boolean zzboolean;\n" +
2392
            "	Object zzObject;\n" +
2393
            "	\n" +
2394
            "	void foo() {\n" +
2395
            "		new CompletionAllocation_ERROR_ExpressionIsParent6Plus().new Inner(1, zz\n" +
2396
            "	}\n" +
2397
            "}\n" +
2398
            "class CompletionAllocationExpressionIsParent6Plus {\n" +
2399
            "	public class Inner {\n" +
2400
            "		public Inner(long i, long j){\n" +
2401
            "			\n" +
2402
            "		}	\n" +
2403
            "	}	\n" +
2278
            "	}	\n" +
2404
            "}");
2279
            "}");
2405
    
2280
    
2406
    
2281
    
2407
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2282
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2408
    String str = this.wc.getSource();
2283
    String str = this.wc.getSource();
2409
    String completeBehind = "zz";
2284
    String completeBehind = "bar";
2410
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2285
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2411
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2286
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2412
2287
2413
    assertResults(
2288
	assertResults(
2414
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent6;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2289
		"bar[FIELD_REF]{CompletionSameSuperClass.this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
2415
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent6;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2290
		"bar[FIELD_REF]{this.bar, LA;, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
2416
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent6;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2291
		"bar[METHOD_REF]{CompletionSameSuperClass.this.bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}\n"+
2417
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent6;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2292
		"bar[LOCAL_VARIABLE_REF]{bar, null, I, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
2418
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent6;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
2293
		"bar[METHOD_REF]{bar(), LA;, ()V, bar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2419
            requestor.getResults());
2420
}
2421
2422
public void testCompletionFieldInitializer1() throws JavaModelException {
2423
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2424
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer1.java");
2425
2426
	String str = cu.getSource();
2427
	String completeBehind = "zz";
2428
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2429
	cu.codeComplete(cursorLocation, requestor);
2430
2431
	assertEquals(
2432
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2433
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2434
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2435
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2436
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2437
		requestor.getResults());
2294
		requestor.getResults());
2438
}
2295
}
2439
2296
2440
public void testCompletionFieldInitializer2() throws JavaModelException {
2297
public void testCompletionSuperType() throws JavaModelException {
2441
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2298
	ICompilationUnit superClass = null;
2442
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer2.java");
2299
	try {
2443
2300
		superClass = getWorkingCopy(
2444
	String str = cu.getSource();
2301
	            "/Completion/src/CompletionSuperClass.java",
2445
	String completeBehind = "zz";
2302
	            "public class CompletionSuperClass{\n" +
2446
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2303
	            "	public class Inner {}\n" +
2447
	cu.codeComplete(cursorLocation, requestor);
2304
	            "	public int eqFoo(int a,Object b){\n" +
2448
2305
	            "		return 1;\n" +
2449
	assertEquals(
2306
	            "	}\n" +
2450
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2307
	            "}");
2451
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2308
		
2452
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2309
		this.wc = getWorkingCopy(
2453
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2310
	            "/Completion/src/CompletionSuperType.java",
2454
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2311
	            "public class CompletionSuperType extends CompletionSuperClass.");
2455
		requestor.getResults());
2312
	    
2313
	    
2314
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2315
	    String str = this.wc.getSource();
2316
	    String completeBehind = "CompletionSuperClass.";
2317
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2318
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2319
	
2320
		assertResults(
2321
			"CompletionSuperClass.Inner[TYPE_REF]{Inner, , LCompletionSuperClass$Inner;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS+ R_NON_RESTRICTED)+"}",
2322
			requestor.getResults());
2323
	} finally {
2324
		if(superClass != null) {
2325
			superClass.discardWorkingCopy();
2326
		}
2327
	}
2456
}
2328
}
2457
2329
2458
public void testCompletionFieldInitializer3() throws JavaModelException {
2330
public void testCompletionSuperType2() throws JavaModelException {
2459
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2331
	ICompilationUnit superClass = null;
2460
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer3.java");
2332
	ICompilationUnit superClass2 = null;
2461
2333
	ICompilationUnit superInterface = null;
2462
	String str = cu.getSource();
2334
	ICompilationUnit superInterface2 = null;
2463
	String completeBehind = "Objec";
2335
	try {
2464
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2336
		superClass = getWorkingCopy(
2465
	cu.codeComplete(cursorLocation, requestor);
2337
	            "/Completion/src/CompletionSuperClass.java",
2466
2338
	            "public class CompletionSuperClass{\n" +
2467
	assertEquals(
2339
	            "	public class Inner {}\n" +
2468
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2340
	            "	public int eqFoo(int a,Object b){\n" +
2469
		requestor.getResults());
2341
	            "		return 1;\n" +
2342
	            "	}\n" +
2343
	            "}");
2344
		
2345
		superClass2 = getWorkingCopy(
2346
	            "/Completion/src/CompletionSuperClass2.java",
2347
	            "public class CompletionSuperClass2 {\n" +
2348
	            "	public class InnerClass {}\n" +
2349
	            "	public interface InnerInterface {}\n" +
2350
	            "}");
2351
		
2352
		superInterface = getWorkingCopy(
2353
	            "/Completion/src/CompletionSuperInterface.java",
2354
	            "public interface CompletionSuperInterface{\n" +
2355
	            "	public int eqFoo(int a,Object b);\n" +
2356
	            "}");
2357
		
2358
		superInterface2 = getWorkingCopy(
2359
	            "/Completion/src/CompletionSuperInterface2.java",
2360
	            "public interface CompletionSuperInterface2 {\n" +
2361
	            "	public class InnerClass {}\n" +
2362
	            "	public interface InnerInterface {}\n" +
2363
	            "}");
2364
		
2365
		this.wc = getWorkingCopy(
2366
	            "/Completion/src/CompletionSuperType2.java",
2367
	            "public class CompletionSuperType2 extends CompletionSuper");
2368
	    
2369
	    
2370
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2371
	    String str = this.wc.getSource();
2372
	    String completeBehind = "CompletionSuper";
2373
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2374
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2375
	
2376
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
2377
			assertResults(
2378
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2379
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2380
				requestor.getResults());
2381
	    } else {
2382
	    	assertResults(
2383
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2384
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2385
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2386
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2387
				requestor.getResults());
2388
	    }
2389
	} finally {
2390
		if(superClass != null) {
2391
			superClass.discardWorkingCopy();
2392
		}
2393
		if(superClass2 != null) {
2394
			superClass2.discardWorkingCopy();
2395
		}
2396
		if(superInterface != null) {
2397
			superInterface.discardWorkingCopy();
2398
		}
2399
		if(superInterface2 != null) {
2400
			superInterface2.discardWorkingCopy();
2401
		}
2402
	}
2470
}
2403
}
2471
2404
2472
public void testCompletionFieldInitializer4() throws JavaModelException {
2405
public void testCompletionSuperType3() throws JavaModelException {
2473
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2406
	ICompilationUnit superClass = null;
2474
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer4.java");
2407
	ICompilationUnit superClass2 = null;
2475
2408
	ICompilationUnit superInterface = null;
2476
	String str = cu.getSource();
2409
	ICompilationUnit superInterface2 = null;
2477
	String completeBehind = "Objec";
2410
	try {
2478
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2411
		superClass = getWorkingCopy(
2479
	cu.codeComplete(cursorLocation, requestor);
2412
	            "/Completion/src/CompletionSuperClass.java",
2480
2413
	            "public class CompletionSuperClass{\n" +
2481
	assertEquals(
2414
	            "	public class Inner {}\n" +
2482
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2415
	            "	public int eqFoo(int a,Object b){\n" +
2483
		requestor.getResults());
2416
	            "		return 1;\n" +
2417
	            "	}\n" +
2418
	            "}");
2419
		
2420
		superClass2 = getWorkingCopy(
2421
	            "/Completion/src/CompletionSuperClass2.java",
2422
	            "public class CompletionSuperClass2 {\n" +
2423
	            "	public class InnerClass {}\n" +
2424
	            "	public interface InnerInterface {}\n" +
2425
	            "}");
2426
		
2427
		superInterface = getWorkingCopy(
2428
	            "/Completion/src/CompletionSuperInterface.java",
2429
	            "public interface CompletionSuperInterface{\n" +
2430
	            "	public int eqFoo(int a,Object b);\n" +
2431
	            "}");
2432
		
2433
		superInterface2 = getWorkingCopy(
2434
	            "/Completion/src/CompletionSuperInterface2.java",
2435
	            "public interface CompletionSuperInterface2 {\n" +
2436
	            "	public class InnerClass {}\n" +
2437
	            "	public interface InnerInterface {}\n" +
2438
	            "}");
2439
		
2440
		this.wc = getWorkingCopy(
2441
	            "/Completion/src/CompletionSuperType3.java",
2442
	            "public class CompletionSuperType3 implements CompletionSuper");
2443
	    
2444
	    
2445
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2446
	    String str = this.wc.getSource();
2447
	    String completeBehind = "CompletionSuper";
2448
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2449
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2450
	
2451
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
2452
			assertResults(
2453
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2454
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2455
				requestor.getResults());
2456
	    } else {
2457
	    	assertResults(
2458
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2459
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2460
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2461
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2462
				requestor.getResults());
2463
	    }
2464
	} finally {
2465
		if(superClass != null) {
2466
			superClass.discardWorkingCopy();
2467
		}
2468
		if(superClass2 != null) {
2469
			superClass2.discardWorkingCopy();
2470
		}
2471
		if(superInterface != null) {
2472
			superInterface.discardWorkingCopy();
2473
		}
2474
		if(superInterface2 != null) {
2475
			superInterface2.discardWorkingCopy();
2476
		}
2477
	}
2484
}
2478
}
2485
public void testCompletionVariableInitializerInInitializer1() throws JavaModelException {
2486
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2487
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer1.java");
2488
2489
	String str = cu.getSource();
2490
	String completeBehind = "zz";
2491
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2492
	cu.codeComplete(cursorLocation, requestor);
2493
2479
2494
	assertEquals(
2480
public void testCompletionSuperType4() throws JavaModelException {
2495
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2481
	ICompilationUnit superClass2 = null;
2496
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2482
	try {
2497
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2483
		superClass2 = getWorkingCopy(
2498
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2484
	            "/Completion/src/CompletionSuperClass2.java",
2499
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2485
	            "public class CompletionSuperClass2 {\n" +
2500
		requestor.getResults());
2486
	            "	public class InnerClass {}\n" +
2487
	            "	public interface InnerInterface {}\n" +
2488
	            "}");
2489
		
2490
		this.wc = getWorkingCopy(
2491
	            "/Completion/src/CompletionSuperType4.java",
2492
	            "public class CompletionSuperType4 extends CompletionSuperClass2.Inner");
2493
	    
2494
	    
2495
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2496
	    String str = this.wc.getSource();
2497
	    String completeBehind = "CompletionSuperClass2.Inner";
2498
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2499
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2500
	
2501
		assertResults(
2502
			"CompletionSuperClass2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperClass2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+ "}\n"+
2503
			"CompletionSuperClass2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperClass2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_CLASS + R_NON_RESTRICTED)+"}",
2504
			requestor.getResults());
2505
	} finally {
2506
		if(superClass2 != null) {
2507
			superClass2.discardWorkingCopy();
2508
		}
2509
	}
2501
}
2510
}
2502
2511
2503
public void testCompletionVariableInitializerInInitializer2() throws JavaModelException {
2512
public void testCompletionSuperType5() throws JavaModelException {
2504
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2513
	ICompilationUnit superInterface2 = null;
2505
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer2.java");
2514
	try {
2506
2515
		superInterface2 = getWorkingCopy(
2507
	String str = cu.getSource();
2516
	            "/Completion/src/CompletionSuperInterface2.java",
2508
	String completeBehind = "zz";
2517
	            "public interface CompletionSuperInterface2 {\n" +
2509
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2518
	            "	public class InnerClass {}\n" +
2510
	cu.codeComplete(cursorLocation, requestor);
2519
	            "	public interface InnerInterface {}\n" +
2511
2520
	            "}");
2512
	assertEquals(
2521
		
2513
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2522
		this.wc = getWorkingCopy(
2514
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2523
	            "/Completion/src/CompletionSuperType5.java",
2515
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2524
	            "public class CompletionSuperType5 implements CompletionSuperInterface2.Inner");
2516
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2525
	    
2517
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2526
	    
2518
		requestor.getResults());
2527
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2528
	    String str = this.wc.getSource();
2529
	    String completeBehind = "CompletionSuperInterface2.Inner";
2530
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2531
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2532
	
2533
		assertResults(
2534
			"CompletionSuperInterface2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperInterface2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
2535
			"CompletionSuperInterface2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperInterface2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
2536
			requestor.getResults());
2537
	} finally {
2538
		if(superInterface2 != null) {
2539
			superInterface2.discardWorkingCopy();
2540
		}
2541
	}
2519
}
2542
}
2520
2543
2521
public void testCompletionVariableInitializerInInitializer3() throws JavaModelException {
2544
public void testCompletionSuperType6() throws JavaModelException {
2522
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2545
	ICompilationUnit superClass = null;
2523
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer3.java");
2546
	ICompilationUnit superClass2 = null;
2524
2547
	ICompilationUnit superInterface = null;
2525
	String str = cu.getSource();
2548
	ICompilationUnit superInterface2 = null;
2526
	String completeBehind = "Objec";
2549
	try {
2527
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2550
		superClass = getWorkingCopy(
2528
	cu.codeComplete(cursorLocation, requestor);
2551
	            "/Completion/src/CompletionSuperClass.java",
2529
2552
	            "public class CompletionSuperClass{\n" +
2530
	assertEquals(
2553
	            "	public class Inner {}\n" +
2531
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2554
	            "	public int eqFoo(int a,Object b){\n" +
2532
		requestor.getResults());
2555
	            "		return 1;\n" +
2556
	            "	}\n" +
2557
	            "}");
2558
		
2559
		superClass2 = getWorkingCopy(
2560
	            "/Completion/src/CompletionSuperClass2.java",
2561
	            "public class CompletionSuperClass2 {\n" +
2562
	            "	public class InnerClass {}\n" +
2563
	            "	public interface InnerInterface {}\n" +
2564
	            "}");
2565
		
2566
		superInterface = getWorkingCopy(
2567
	            "/Completion/src/CompletionSuperInterface.java",
2568
	            "public interface CompletionSuperInterface{\n" +
2569
	            "	public int eqFoo(int a,Object b);\n" +
2570
	            "}");
2571
		
2572
		superInterface2 = getWorkingCopy(
2573
	            "/Completion/src/CompletionSuperInterface2.java",
2574
	            "public interface CompletionSuperInterface2 {\n" +
2575
	            "	public class InnerClass {}\n" +
2576
	            "	public interface InnerInterface {}\n" +
2577
	            "}");
2578
		
2579
		this.wc = getWorkingCopy(
2580
	            "/Completion/src/CompletionSuperType6.java",
2581
	            "public interface CompletionSuperType6 extends CompletionSuper");
2582
	    
2583
	    
2584
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2585
	    String str = this.wc.getSource();
2586
	    String completeBehind = "CompletionSuper";
2587
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2588
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2589
	
2590
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
2591
			assertResults(
2592
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE + R_NON_RESTRICTED)+"}\n" +
2593
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE+ R_NON_RESTRICTED)+"}",
2594
				requestor.getResults());
2595
	    } else {
2596
	    	assertResults(
2597
				"CompletionSuperClass[TYPE_REF]{CompletionSuperClass, , LCompletionSuperClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2598
				"CompletionSuperClass2[TYPE_REF]{CompletionSuperClass2, , LCompletionSuperClass2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
2599
				"CompletionSuperInterface[TYPE_REF]{CompletionSuperInterface, , LCompletionSuperInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE + R_NON_RESTRICTED)+"}\n" +
2600
				"CompletionSuperInterface2[TYPE_REF]{CompletionSuperInterface2, , LCompletionSuperInterface2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_INTERFACE+ R_NON_RESTRICTED)+"}",
2601
				requestor.getResults());
2602
	    }
2603
	} finally {
2604
		if(superClass != null) {
2605
			superClass.discardWorkingCopy();
2606
		}
2607
		if(superClass2 != null) {
2608
			superClass2.discardWorkingCopy();
2609
		}
2610
		if(superInterface != null) {
2611
			superInterface.discardWorkingCopy();
2612
		}
2613
		if(superInterface2 != null) {
2614
			superInterface2.discardWorkingCopy();
2615
		}
2616
	}
2533
}
2617
}
2534
2618
2535
public void testCompletionVariableInitializerInInitializer4() throws JavaModelException {
2619
public void testCompletionSuperType7() throws JavaModelException {
2536
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2620
	ICompilationUnit superClass2 = null;
2537
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer4.java");
2621
	try {
2538
2622
		superClass2 = getWorkingCopy(
2539
	String str = cu.getSource();
2623
	            "/Completion/src/CompletionSuperClass2.java",
2540
	String completeBehind = "Objec";
2624
	            "public class CompletionSuperClass2 {\n" +
2541
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2625
	            "	public class InnerClass {}\n" +
2542
	cu.codeComplete(cursorLocation, requestor);
2626
	            "	public interface InnerInterface {}\n" +
2543
2627
	            "}");
2544
	assertEquals(
2628
		
2545
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2629
		this.wc = getWorkingCopy(
2546
		requestor.getResults());
2630
	            "/Completion/src/CompletionSuperType7.java",
2631
	            "public interface CompletionSuperType7 extends CompletionSuperClass2.Inner");
2632
	    
2633
	    
2634
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2635
	    String str = this.wc.getSource();
2636
	    String completeBehind = "CompletionSuperClass2.Inner";
2637
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2638
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2639
	
2640
		assertResults(
2641
			"CompletionSuperClass2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperClass2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
2642
			"CompletionSuperClass2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperClass2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
2643
			requestor.getResults());
2644
	} finally {
2645
		if(superClass2 != null) {
2646
			superClass2.discardWorkingCopy();
2647
		}
2648
	}
2547
}
2649
}
2548
public void testCompletionVariableInitializerInMethod1() throws JavaModelException {
2549
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2550
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod1.java");
2551
2552
	String str = cu.getSource();
2553
	String completeBehind = "zz";
2554
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2555
	cu.codeComplete(cursorLocation, requestor);
2556
2650
2557
	assertEquals(
2651
public void testCompletionSuperType8() throws JavaModelException {
2558
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2652
	ICompilationUnit superInterface2 = null;
2559
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2653
	try {
2560
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2654
		superInterface2 = getWorkingCopy(
2561
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2655
	            "/Completion/src/CompletionSuperInterface2.java",
2562
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2656
	            "public interface CompletionSuperInterface2 {\n" +
2563
		requestor.getResults());
2657
	            "	public class InnerClass {}\n" +
2658
	            "	public interface InnerInterface {}\n" +
2659
	            "}");
2660
		
2661
		this.wc = getWorkingCopy(
2662
	            "/Completion/src/CompletionSuperType8.java",
2663
	            "public interface CompletionSuperType8 extends CompletionSuperInterface2.Inner");
2664
	    
2665
	    
2666
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2667
	    String str = this.wc.getSource();
2668
	    String completeBehind = "CompletionSuperInterface2.Inner";
2669
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2670
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2671
	
2672
		assertResults(
2673
			"CompletionSuperInterface2.InnerClass[TYPE_REF]{InnerClass, , LCompletionSuperInterface2$InnerClass;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
2674
			"CompletionSuperInterface2.InnerInterface[TYPE_REF]{InnerInterface, , LCompletionSuperInterface2$InnerInterface;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_INTERFACE+ R_NON_RESTRICTED)+"}",
2675
			requestor.getResults());
2676
	} finally {
2677
		if(superInterface2 != null) {
2678
			superInterface2.discardWorkingCopy();
2679
		}
2680
	}
2564
}
2681
}
2565
2682
2566
public void testCompletionVariableInitializerInMethod2() throws JavaModelException {
2683
public void testCompletionMethodThrowsClause() throws JavaModelException {
2567
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2684
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2568
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod2.java");
2685
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause.java");
2569
2686
2570
	String str = cu.getSource();
2687
	String str = cu.getSource();
2571
	String completeBehind = "zz";
2688
	String completeBehind = "Ex";
2572
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2689
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2573
	cu.codeComplete(cursorLocation, requestor);
2690
	cu.codeComplete(cursorLocation, requestor);
2574
2691
2575
	assertEquals(
2692
	assertEquals(
2576
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2693
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED),
2577
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2578
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2579
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2580
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2581
		requestor.getResults());
2694
		requestor.getResults());
2582
}
2695
}
2583
2696
2584
public void testCompletionVariableInitializerInMethod3() throws JavaModelException {
2697
public void testCompletionMethodThrowsClause2() throws JavaModelException {
2585
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2698
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2586
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod3.java");
2699
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMethodThrowsClause2.java");
2587
2700
2588
	String str = cu.getSource();
2701
	String str = cu.getSource();
2589
	String completeBehind = "Objec";
2702
	String completeBehind = "Ex";
2590
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2703
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2591
	cu.codeComplete(cursorLocation, requestor);
2704
	cu.codeComplete(cursorLocation, requestor);
2592
2705
2593
	assertEquals(
2706
	assertEquals(
2594
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2707
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_NON_RESTRICTED),
2595
		requestor.getResults());
2708
		requestor.getResults());
2596
}
2709
}
2597
2710
2598
public void testCompletionVariableInitializerInMethod4() throws JavaModelException {
2711
public void testCompletionThrowStatement() throws JavaModelException {
2599
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2712
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2600
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod4.java");
2713
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionThrowStatement.java");
2601
2714
2602
	String str = cu.getSource();
2715
	String str = cu.getSource();
2603
	String completeBehind = "Objec";
2716
	String completeBehind = "Ex";
2604
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2717
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2605
	cu.codeComplete(cursorLocation, requestor);
2718
	cu.codeComplete(cursorLocation, requestor);
2606
2719
2607
	assertEquals(
2720
	assertEquals(
2608
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2721
		"element:Exception    completion:Exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION + R_UNQUALIFIED+ R_NON_RESTRICTED),
2609
		requestor.getResults());
2722
		requestor.getResults());
2610
}
2723
}
2611
public void testCompletionAssignmentInMethod1() throws JavaModelException {
2724
2725
public void testCompletionUnresolvedReturnType() throws JavaModelException {
2612
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2726
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2613
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod1.java");
2727
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedReturnType.java");
2614
2728
2615
	String str = cu.getSource();
2729
	String str = cu.getSource();
2616
	String completeBehind = "zz";
2730
	String completeBehind = "bar";
2617
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2731
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2618
	cu.codeComplete(cursorLocation, requestor);
2732
	cu.codeComplete(cursorLocation, requestor);
2619
2733
2620
	assertEquals(
2734
	assertEquals(
2621
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2735
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
2622
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2623
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2624
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2625
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2626
		requestor.getResults());
2736
		requestor.getResults());
2627
}
2737
}
2628
2738
2629
public void testCompletionAssignmentInMethod2() throws JavaModelException {
2739
public void testCompletionUnresolvedParameterType() throws JavaModelException {
2630
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2740
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2631
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod2.java");
2741
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedParameterType.java");
2632
2742
2633
	String str = cu.getSource();
2743
	String str = cu.getSource();
2634
	String completeBehind = "zz";
2744
	String completeBehind = "bar";
2635
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2745
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2636
	cu.codeComplete(cursorLocation, requestor);
2746
	cu.codeComplete(cursorLocation, requestor);
2637
2747
2638
	assertEquals(
2748
	assertEquals(
2639
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2749
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
2640
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2641
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2642
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2643
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2644
		requestor.getResults());
2750
		requestor.getResults());
2645
}
2751
}
2646
2752
2647
public void testCompletionAssignmentInMethod3() throws JavaModelException {
2753
public void testCompletionUnresolvedFieldType() throws JavaModelException {
2648
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2754
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2649
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod3.java");
2755
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedFieldType.java");
2650
2756
2651
	String str = cu.getSource();
2757
	String str = cu.getSource();
2652
	String completeBehind = "Objec";
2758
	String completeBehind = "bar";
2653
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2759
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2654
	cu.codeComplete(cursorLocation, requestor);
2760
	cu.codeComplete(cursorLocation, requestor);
2655
2761
2656
	assertEquals(
2762
	assertEquals(
2657
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2763
		"element:barPlus    completion:barPlus()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
2658
		requestor.getResults());
2764
		requestor.getResults());
2659
}
2765
}
2660
2766
/*
2661
public void testCompletionAssignmentInMethod4() throws JavaModelException {
2767
 * bug : http://dev.eclipse.org/bugs/show_bug.cgi?id=24440
2768
 */
2769
public void testCompletionUnresolvedEnclosingType() throws JavaModelException {
2662
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2770
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2663
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod4.java");
2771
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnresolvedEnclosingType.java");
2664
2772
2665
	String str = cu.getSource();
2773
	String str = cu.getSource();
2666
	String completeBehind = "Objec";
2774
	String completeBehind = "new ZZZ(";
2667
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2775
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2668
	cu.codeComplete(cursorLocation, requestor);
2776
	cu.codeComplete(cursorLocation, requestor);
2669
2777
2670
	assertEquals(
2778
	assertTrue(
2671
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2779
		requestor.getResults().length() == 0);
2672
		requestor.getResults());
2673
}
2780
}
2674
/*
2781
public void testCompletionReturnStatementIsParent1() throws JavaModelException {
2675
* http://dev.eclipse.org/bugs/show_bug.cgi?id=24565
2676
*/
2677
public void testCompletionObjectsMethodWithInterfaceReceiver() throws JavaModelException {
2678
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2782
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2679
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionObjectsMethodWithInterfaceReceiver.java");
2783
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent1.java");
2680
2784
2681
	String str = cu.getSource();
2785
	String str = cu.getSource();
2682
	String completeBehind = "hash";
2786
	String completeBehind = "zz";
2683
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2787
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2684
	cu.codeComplete(cursorLocation, requestor);
2788
	cu.codeComplete(cursorLocation, requestor);
2685
2789
2686
	assertEquals(
2790
	assertEquals(
2687
		"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
2791
		"element:zz00    completion:zz00    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2792
		"element:zz00M    completion:zz00M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2793
		"element:zz01    completion:zz01    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2794
		"element:zz01M    completion:zz01M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2795
		"element:zz02    completion:zz02    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2796
		"element:zz02M    completion:zz02M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2797
		"element:zz10    completion:zz10    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2798
		"element:zz10M    completion:zz10M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2799
		"element:zz11    completion:zz11    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2800
		"element:zz11M    completion:zz11M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2801
		"element:zz12    completion:zz12    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2802
		"element:zz12M    completion:zz12M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2803
		"element:zz20    completion:zz20    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2804
		"element:zz20M    completion:zz20M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2805
		"element:zz21    completion:zz21    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2806
		"element:zz21M    completion:zz21M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2807
		"element:zz22    completion:zz22    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2808
		"element:zz22M    completion:zz22M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2809
		"element:zzOb    completion:zzOb    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2810
		"element:zzObM    completion:zzObM()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2688
		requestor.getResults());
2811
		requestor.getResults());
2689
}
2812
}
2690
/*
2813
2691
* http://dev.eclipse.org/bugs/show_bug.cgi?id=24939
2814
public void testCompletionReturnStatementIsParent2() throws JavaModelException {
2692
*/
2693
public void testCompletionConstructorForAnonymousType() throws JavaModelException {
2694
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2815
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2695
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConstructorForAnonymousType.java");
2816
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnStatementIsParent2.java");
2696
2817
2697
	String str = cu.getSource();
2818
	String str = cu.getSource();
2698
	String completeBehind = "TypeWithConstructor(";
2819
	String completeBehind = "xx";
2699
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2820
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2700
	cu.codeComplete(cursorLocation, requestor);
2821
	cu.codeComplete(cursorLocation, requestor);
2701
2822
2702
	assertEquals(
2823
	assertEquals(
2703
		"element:TypeWithConstructor    completion:    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED),
2824
		"element:XX00    completion:XX00    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2825
		"element:XX01    completion:XX01    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2826
		"element:XX02    completion:XX02    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2827
		"element:XX10    completion:XX10    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2828
		"element:XX11    completion:XX11    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2829
		"element:XX12    completion:XX12    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2830
		"element:XX20    completion:XX20    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2831
		"element:XX21    completion:XX21    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2832
		"element:XX22    completion:XX22    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
2704
		requestor.getResults());
2833
		requestor.getResults());
2705
}
2834
}
2706
/*
2707
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
2708
*/
2709
public void testCompletionEmptyTypeName1() throws JavaModelException {
2710
	this.wc = getWorkingCopy(
2711
            "/Completion/src/CompletionEmptyTypeName1.java",
2712
            "public class CompletionEmptyTypeName1 {\n"+
2713
           "	void foo() {\n"+
2714
           "		A a = new \n"+
2715
           "	}\n"+
2716
           "}");
2717
    
2718
    
2719
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2720
    String str = this.wc.getSource();
2721
    String completeBehind = "new ";
2722
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2723
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2724
2835
2725
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
2836
public void testCompletionCastIsParent1() throws JavaModelException {
2726
		assertResults(
2727
			"A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2728
			requestor.getResults());
2729
	} else {
2730
		assertResults(
2731
			"CompletionEmptyTypeName1[TYPE_REF]{CompletionEmptyTypeName1, , LCompletionEmptyTypeName1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}\n"+
2732
			"A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2733
			requestor.getResults());
2734
	}
2735
}
2736
/*
2737
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
2738
*/
2739
public void testCompletionEmptyTypeName2() throws JavaModelException {
2740
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2837
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2741
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName2.java");
2838
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent1.java");
2742
2839
2743
	String str = cu.getSource();
2840
	String str = cu.getSource();
2744
	String completeBehind = " = ";
2841
	String completeBehind = "zz";
2745
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2842
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2746
	cu.codeComplete(cursorLocation, requestor);
2843
	cu.codeComplete(cursorLocation, requestor);
2747
2844
2748
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
2845
	assertEquals(
2749
		assertEquals(
2846
		"element:zz00    completion:zz00    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2750
			"element:a    completion:a    relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2847
		"element:zz00M    completion:zz00M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2751
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2848
		"element:zz01    completion:zz01    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2752
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2849
		"element:zz01M    completion:zz01M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2753
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
2850
		"element:zz02    completion:zz02    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2754
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2851
		"element:zz02M    completion:zz02M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2755
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2852
		"element:zz10    completion:zz10    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2756
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2853
		"element:zz10M    completion:zz10M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2757
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2854
		"element:zz11    completion:zz11    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2758
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2855
		"element:zz11M    completion:zz11M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2759
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2856
		"element:zz12    completion:zz12    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2760
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2857
		"element:zz12M    completion:zz12M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2761
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2858
		"element:zz20    completion:zz20    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2762
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2859
		"element:zz20M    completion:zz20M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2763
			requestor.getResults());
2860
		"element:zz21    completion:zz21    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2764
	} else {
2861
		"element:zz21M    completion:zz21M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2765
		assertEquals(
2862
		"element:zz22    completion:zz22    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2766
			"element:A    completion:A    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2863
		"element:zz22M    completion:zz22M()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2767
			"element:CompletionEmptyTypeName2    completion:CompletionEmptyTypeName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2864
		"element:zzOb    completion:zzOb    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2768
			"element:a    completion:a    relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2865
		"element:zzObM    completion:zzObM()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2769
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2866
		requestor.getResults());
2770
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2771
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
2772
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2773
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2774
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2775
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2776
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2777
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2778
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2779
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2780
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2781
			requestor.getResults());
2782
	}
2783
}
2867
}
2784
/*
2868
2785
* http://dev.eclipse.org/bugs/show_bug.cgi?id=41643
2869
public void testCompletionCastIsParent2() throws JavaModelException {
2786
*/
2787
public void testCompletionEmptyTypeName3() throws JavaModelException {
2788
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2870
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2789
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName3.java");
2871
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCastIsParent2.java");
2790
2872
2791
	String str = cu.getSource();
2873
	String str = cu.getSource();
2792
	String completeBehind = " = ";
2874
	String completeBehind = "xx";
2793
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2875
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2794
	cu.codeComplete(cursorLocation, requestor);
2876
	cu.codeComplete(cursorLocation, requestor);
2795
2877
2796
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
2878
	assertEquals(
2797
		assertEquals(
2879
		"element:XX00    completion:XX00    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2798
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2880
		"element:XX01    completion:XX01    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2799
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2881
		"element:XX02    completion:XX02    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2800
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
2882
		"element:XX10    completion:XX10    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2801
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2883
		"element:XX11    completion:XX11    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2802
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2884
		"element:XX12    completion:XX12    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2803
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2885
		"element:XX20    completion:XX20    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2804
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2886
		"element:XX21    completion:XX21    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2805
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2887
		"element:XX22    completion:XX22    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
2806
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2888
		requestor.getResults());
2807
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2808
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2809
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2810
			"element:x    completion:x    relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
2811
			requestor.getResults());
2812
	} else {
2813
		assertEquals(
2814
			"element:CompletionEmptyTypeName2    completion:CompletionEmptyTypeName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
2815
			"element:CompletionEmptyTypeName3    completion:CompletionEmptyTypeName3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2816
			"element:CompletionEmptyTypeName3.CompletionEmptyTypeName3_1    completion:CompletionEmptyTypeName3_1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2817
			"element:CompletionEmptyTypeName3_2    completion:CompletionEmptyTypeName3_2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2818
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2819
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2820
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
2821
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2822
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2823
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2824
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2825
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2826
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2827
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2828
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2829
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2830
			"element:x    completion:x    relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
2831
			requestor.getResults());
2832
	}
2833
}
2834
/*
2835
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
2836
*/
2837
public void testCompletionAbstractMethodRelevance1() throws JavaModelException {
2838
	ICompilationUnit superClass = null;
2839
	try {
2840
		superClass = getWorkingCopy(
2841
	            "/Completion/src/CompletionAbstractSuperClass.java",
2842
	            "public abstract class CompletionAbstractSuperClass {\n"+
2843
	            "	public void foo1(){}\n"+
2844
	            "	public abstract void foo2();\n"+
2845
	            "	public void foo3(){}\n"+
2846
	            "}");
2847
		
2848
		this.wc = getWorkingCopy(
2849
	            "/Completion/src/CompletionAbstractMethodRelevance1.java",
2850
	            "public class CompletionAbstractMethodRelevance1 extends CompletionAbstractSuperClass {\n"+
2851
	            "	foo\n"+
2852
	            "}");
2853
	    
2854
	    
2855
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2856
	    String str = this.wc.getSource();
2857
	    String completeBehind = "foo";
2858
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2859
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2860
	
2861
		assertResults(
2862
			"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionAbstractMethodRelevance1;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
2863
			"foo1[METHOD_DECLARATION]{public void foo1(), LCompletionAbstractSuperClass;, ()V, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
2864
			"foo3[METHOD_DECLARATION]{public void foo3(), LCompletionAbstractSuperClass;, ()V, foo3, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
2865
			"foo2[METHOD_DECLARATION]{public void foo2(), LCompletionAbstractSuperClass;, ()V, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
2866
			requestor.getResults());
2867
	} finally {
2868
		if(superClass != null) {
2869
			superClass.discardWorkingCopy();
2870
		}
2871
	}
2872
}
2873
/*
2874
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
2875
*/
2876
public void testCompletionAbstractMethodRelevance2() throws JavaModelException {
2877
	ICompilationUnit superClass = null;
2878
	try {
2879
		superClass = getWorkingCopy(
2880
	            "/Completion/src/CompletionSuperInterface.java",
2881
	            "public interface CompletionSuperInterface{\n"+
2882
	            "	public int eqFoo(int a,Object b);\n"+
2883
	            "}");
2884
		
2885
		this.wc = getWorkingCopy(
2886
	            "/Completion/src/CompletionAbstractMethodRelevance2.java",
2887
	            "public class CompletionAbstractMethodRelevance2 implements CompletionSuperInterface {\n"+
2888
	            "	eq\n"+
2889
	            "}");
2890
	    
2891
	    
2892
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2893
	    String str = this.wc.getSource();
2894
	    String completeBehind = "eq";
2895
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2896
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2897
	
2898
		assertResults(
2899
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionAbstractMethodRelevance2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
2900
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
2901
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
2902
			requestor.getResults());
2903
	} finally {
2904
		if(superClass != null) {
2905
			superClass.discardWorkingCopy();
2906
		}
2907
	}
2908
}
2889
}
2909
/*
2890
2910
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25591
2891
public void testCompletionMessageSendIsParent1() throws JavaModelException {
2911
*/
2912
public void testCompletionReturnInInitializer() throws JavaModelException {
2913
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2892
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2914
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnInInitializer.java");
2893
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent1.java");
2915
2894
2916
	String str = cu.getSource();
2895
	String str = cu.getSource();
2917
	String completeBehind = "eq";
2896
	String completeBehind = "zz";
2918
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2897
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2919
	cu.codeComplete(cursorLocation, requestor);
2898
	cu.codeComplete(cursorLocation, requestor);
2920
2899
2921
	assertEquals(
2900
	assertEquals(
2922
		"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2901
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2902
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2903
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2904
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2905
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2923
		requestor.getResults());
2906
		requestor.getResults());
2924
}
2907
}
2925
/*
2908
2926
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
2909
public void testCompletionMessageSendIsParent2() throws JavaModelException {
2927
*/
2928
public void testCompletionVariableName1() throws JavaModelException {
2929
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2910
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2930
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName1.java");
2911
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent2.java");
2931
2912
2932
	String str = cu.getSource();
2913
	String str = cu.getSource();
2933
	String completeBehind = "TEST_FOO_MyClass ";
2914
	String completeBehind = "zz";
2934
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2915
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2935
	cu.codeComplete(cursorLocation, requestor);
2916
	cu.codeComplete(cursorLocation, requestor);
2936
2917
2937
	assertEquals(
2918
	assertEquals(
2938
		"element:class1    completion:class1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2919
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2939
		"element:myClass    completion:myClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
2920
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2921
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2922
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2923
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2940
		requestor.getResults());
2924
		requestor.getResults());
2941
}
2925
}
2942
/*
2926
2943
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
2927
public void testCompletionMessageSendIsParent3() throws JavaModelException {
2944
*/
2945
public void testCompletionVariableName2() throws JavaModelException {
2946
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2928
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2947
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName2.java");
2929
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent3.java");
2948
2930
2949
	String str = cu.getSource();
2931
	String str = cu.getSource();
2950
	String completeBehind = "Test_Bar_MyClass ";
2932
	String completeBehind = "zz";
2951
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2933
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2952
	cu.codeComplete(cursorLocation, requestor);
2934
	cu.codeComplete(cursorLocation, requestor);
2953
2935
2954
	assertEquals(
2936
	assertEquals(
2955
		"element:bar_MyClass    completion:bar_MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2937
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2956
		"element:class1    completion:class1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2938
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2957
		"element:myClass    completion:myClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
2939
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2958
		"element:test_Bar_MyClass    completion:test_Bar_MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
2940
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2941
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2959
		requestor.getResults());
2942
		requestor.getResults());
2960
}
2943
}
2961
/*
2944
2962
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25820
2945
public void testCompletionMessageSendIsParent4() throws JavaModelException {
2963
*/
2964
public void testCompletionExpectedTypeIsNotValid() throws JavaModelException {
2965
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2946
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2966
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExpectedTypeIsNotValid.java");
2947
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent4.java");
2967
2948
2968
	String str = cu.getSource();
2949
	String str = cu.getSource();
2969
	String completeBehind = "new U";
2950
	String completeBehind = "zz";
2970
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2951
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2971
	cu.codeComplete(cursorLocation, requestor);
2952
	cu.codeComplete(cursorLocation, requestor);
2972
2953
2973
	assertEquals(
2954
	assertEquals(
2974
		"",
2955
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2956
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2957
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2958
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2959
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2975
		requestor.getResults());
2960
		requestor.getResults());
2976
}
2961
}
2977
/*
2978
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
2979
*/
2980
public void testCompletionMemberType() throws JavaModelException {
2981
	this.wc = getWorkingCopy(
2982
            "/Completion/src/CompletionMemberType.java",
2983
            "public class CompletionMemberType {\n"+
2984
            "	public class Y {\n"+
2985
            "		public void foo(){\n"+
2986
            "			Y var = new Y\n"+
2987
            "		}\n"+
2988
            "	}\n"+
2989
            "}");
2990
    
2991
    
2992
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2993
    String str = this.wc.getSource();
2994
    String completeBehind = "new Y";
2995
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2996
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
2997
2962
2998
    assertResults(
2963
public void testCompletionMessageSendIsParent5() throws JavaModelException {
2999
		"CompletionMemberType.Y[TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
2964
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2965
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent5.java");
2966
2967
	String str = cu.getSource();
2968
	String completeBehind = "zz";
2969
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2970
	cu.codeComplete(cursorLocation, requestor);
2971
2972
	assertEquals(
2973
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2974
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2975
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2976
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2977
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3000
		requestor.getResults());
2978
		requestor.getResults());
3001
}
2979
}
3002
/*
2980
3003
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
2981
public void testCompletionMessageSendIsParent6() throws JavaModelException {
3004
*/
3005
public void testCompletionVoidMethod() throws JavaModelException {
3006
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
2982
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3007
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVoidMethod.java");
2983
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionMessageSendIsParent6.java");
3008
2984
3009
	String str = cu.getSource();
2985
	String str = cu.getSource();
3010
	String completeBehind = "foo";
2986
	String completeBehind = "zz";
3011
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2987
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3012
	cu.codeComplete(cursorLocation, requestor);
2988
	cu.codeComplete(cursorLocation, requestor);
3013
2989
3014
	assertEquals(
2990
	assertEquals(
3015
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2991
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3016
		"element:foo1    completion:foo1()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2992
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3017
		"element:foo3    completion:foo3()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
2993
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2994
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
2995
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3018
		requestor.getResults());
2996
		requestor.getResults());
3019
}
2997
}
3020
/*
3021
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
3022
*/
3023
public void testCompletionOnStaticMember1() throws JavaModelException {
3024
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3025
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember1.java");
3026
3027
		String str = cu.getSource();
3028
		String completeBehind = "var";
3029
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3030
		cu.codeComplete(cursorLocation, requestor);
3031
2998
3032
		assertEquals(
2999
public void testCompletionAllocationExpressionIsParent1() throws JavaModelException {
3033
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3000
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3034
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
3001
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent1.java");
3035
			requestor.getResults());
3036
}
3037
/*
3038
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
3039
*/
3040
public void testCompletionOnStaticMember2() throws JavaModelException {
3041
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3042
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember2.java");
3043
3002
3044
		String str = cu.getSource();
3003
	String str = cu.getSource();
3045
		String completeBehind = "method";
3004
	String completeBehind = "zz";
3046
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3005
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3047
		cu.codeComplete(cursorLocation, requestor);
3006
	cu.codeComplete(cursorLocation, requestor);
3048
3007
3049
		assertEquals(
3008
	assertEquals(
3050
			"element:method1    completion:method1()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3009
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3051
			"element:method2    completion:method2()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
3010
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3052
			requestor.getResults());
3011
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3012
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3013
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3014
		requestor.getResults());
3053
}
3015
}
3054
/*
3016
3055
* http://dev.eclipse.org/bugs/show_bug.cgi?id=26677
3017
public void testCompletionAllocationExpressionIsParent2() throws JavaModelException {
3056
*/
3057
public void testCompletionQualifiedExpectedType() throws JavaModelException {
3058
	this.wc = getWorkingCopy(
3018
	this.wc = getWorkingCopy(
3059
            "/Completion/src/test/CompletionQualifiedExpectedType.java",
3019
            "/Completion/src/CompletionAllocationExpressionIsParent2.java",
3060
            "import pack1.PX;\n"+
3020
            "public class CompletionAllocationExpressionIsParent2 {\n" +
3061
            "\n"+
3021
            "	public class Inner {\n" +
3062
            "public class CompletionQualifiedExpectedType {\n"+
3022
            "		public Inner(long i, long j){super();}\n" +
3063
            "	void foo() {\n"+
3023
            "		public Inner(Object i, Object j){super();}\n" +
3064
            "		pack2.PX var = new \n"+
3024
            "		\n" +
3065
            "	}\n"+
3025
            "	}\n" +
3026
            "	\n" +
3027
            "	long zzlong;\n" +
3028
            "	int zzint;\n" +
3029
            "	double zzdouble;\n" +
3030
            "	boolean zzboolean;\n" +
3031
            "	Object zzObject;\n" +
3032
            "	\n" +
3033
            "	void foo() {\n" +
3034
            "		this.new Inner(1, zz\n" +
3035
            "	}\n" +
3066
            "}");
3036
            "}");
3067
    
3037
    
3068
    
3038
    
3069
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3039
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3070
    String str = this.wc.getSource();
3040
    String str = this.wc.getSource();
3071
    String completeBehind = "new ";
3041
    String completeBehind = "zz";
3072
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3042
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3073
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3043
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3074
3044
3075
    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
3045
    assertResults(
3076
    	assertResults(
3046
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent2;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3077
	            "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}",
3047
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent2;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3078
				requestor.getResults());
3048
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent2;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3079
    } else {
3049
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent2;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3080
	    assertResults(
3050
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent2;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
3081
	            "CompletionQualifiedExpectedType[TYPE_REF]{CompletionQualifiedExpectedType, test, Ltest.CompletionQualifiedExpectedType;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3051
            requestor.getResults());
3082
				"PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}",
3083
				requestor.getResults());
3084
    }
3085
}
3086
public void testCompletionUnaryOperator1() throws JavaModelException {
3087
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3088
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator1.java");
3089
3090
		String str = cu.getSource();
3091
		String completeBehind = "var";
3092
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3093
		cu.codeComplete(cursorLocation, requestor);
3094
3095
		assertEquals(
3096
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3097
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3098
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3099
			requestor.getResults());
3100
}
3101
public void testCompletionUnaryOperator2() throws JavaModelException {
3102
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3103
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator2.java");
3104
3105
		String str = cu.getSource();
3106
		String completeBehind = "var";
3107
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3108
		cu.codeComplete(cursorLocation, requestor);
3109
3110
		assertEquals(
3111
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3112
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3113
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3114
			requestor.getResults());
3115
}
3116
public void testCompletionBinaryOperator1() throws JavaModelException {
3117
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3118
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator1.java");
3119
3120
		String str = cu.getSource();
3121
		String completeBehind = "var";
3122
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3123
		cu.codeComplete(cursorLocation, requestor);
3124
3125
		assertEquals(
3126
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3127
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3128
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3129
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
3130
			requestor.getResults());
3131
}
3132
public void testCompletionBinaryOperator2() throws JavaModelException {
3133
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3134
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator2.java");
3135
3136
		String str = cu.getSource();
3137
		String completeBehind = "var";
3138
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3139
		cu.codeComplete(cursorLocation, requestor);
3140
3141
		assertEquals(
3142
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3143
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3144
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3145
			requestor.getResults());
3146
}
3147
public void testCompletionBinaryOperator3() throws JavaModelException {
3148
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3149
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator3.java");
3150
3151
		String str = cu.getSource();
3152
		String completeBehind = "var";
3153
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3154
		cu.codeComplete(cursorLocation, requestor);
3155
3156
		assertEquals(
3157
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3158
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3159
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3160
			requestor.getResults());
3161
}
3162
public void testCompletionInstanceofOperator1() throws JavaModelException {
3163
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3164
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInstanceofOperator1.java");
3165
3166
		String str = cu.getSource();
3167
		String completeBehind = "x instanceof WWWCompletionInstanceof";
3168
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3169
		cu.codeComplete(cursorLocation, requestor);
3170
3171
		assertEquals(
3172
			"element:WWWCompletionInstanceof1    completion:WWWCompletionInstanceof1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3173
			"element:WWWCompletionInstanceof2    completion:WWWCompletionInstanceof2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3174
			"element:WWWCompletionInstanceof3    completion:WWWCompletionInstanceof3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3175
			"element:WWWCompletionInstanceof4    completion:WWWCompletionInstanceof4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3176
			requestor.getResults());
3177
}
3178
public void testCompletionConditionalExpression1() throws JavaModelException {
3179
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3180
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression1.java");
3181
3182
		String str = cu.getSource();
3183
		String completeBehind = "var";
3184
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3185
		cu.codeComplete(cursorLocation, requestor);
3186
3187
		assertEquals(
3188
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3189
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3190
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3191
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3192
			requestor.getResults());
3193
}
3052
}
3194
public void testCompletionConditionalExpression2() throws JavaModelException {
3195
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3196
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression2.java");
3197
3053
3198
		String str = cu.getSource();
3054
public void testCompletionAllocationExpressionIsParent3() throws JavaModelException {
3199
		String completeBehind = "var";
3055
	this.wc = getWorkingCopy(
3200
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3056
            "/Completion/src/CompletionAllocationExpressionIsParent3.java",
3201
		cu.codeComplete(cursorLocation, requestor);
3057
            "public class CompletionAllocationExpressionIsParent3 {\n" +
3058
            "	public class Inner {\n" +
3059
            "		public Inner(long i, long j){super();}\n" +
3060
            "		public Inner(Object i, Object j){super();}\n" +
3061
            "		\n" +
3062
            "	}\n" +
3063
            "	\n" +
3064
            "	long zzlong;\n" +
3065
            "	int zzint;\n" +
3066
            "	double zzdouble;\n" +
3067
            "	boolean zzboolean;\n" +
3068
            "	Object zzObject;\n" +
3069
            "	\n" +
3070
            "	void foo() {\n" +
3071
            "		new CompletionAllocationExpressionIsParent3().new Inner(1, zz\n" +
3072
            "	}\n" +
3073
            "}");
3074
    
3075
    
3076
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3077
    String str = this.wc.getSource();
3078
    String completeBehind = "zz";
3079
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3080
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3202
3081
3203
		assertEquals(
3082
    assertResults(
3204
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3083
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent3;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3205
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3084
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent3;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3206
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3085
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent3;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3207
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3086
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent3;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3208
			requestor.getResults());
3087
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent3;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
3088
            requestor.getResults());
3209
}
3089
}
3210
public void testCompletionConditionalExpression3() throws JavaModelException {
3211
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3212
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression3.java");
3213
3214
		String str = cu.getSource();
3215
		String completeBehind = "var";
3216
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3217
		cu.codeComplete(cursorLocation, requestor);
3218
3090
3219
		assertEquals(
3091
public void testCompletionAllocationExpressionIsParent4() throws JavaModelException {
3220
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3092
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3221
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3093
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent4.java");
3222
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3223
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3224
			requestor.getResults());
3225
}
3226
public void testCompletionKeywordThis1() throws JavaModelException {
3227
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3228
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis1.java");
3229
3094
3230
		String str = cu.getSource();
3095
	String str = cu.getSource();
3231
		String completeBehind = "thi";
3096
	String completeBehind = "zz";
3232
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3097
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3233
		cu.codeComplete(cursorLocation, requestor);
3098
	cu.codeComplete(cursorLocation, requestor);
3234
3099
3235
		assertEquals(
3100
	assertEquals(
3236
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3101
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3237
			requestor.getResults());
3102
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3103
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3104
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3105
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3106
		requestor.getResults());
3238
}
3107
}
3239
public void testCompletionKeywordThis2() throws JavaModelException {
3240
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3241
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis2.java");
3242
3243
		String str = cu.getSource();
3244
		String completeBehind = "thi";
3245
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3246
		cu.codeComplete(cursorLocation, requestor);
3247
3108
3248
		assertEquals(
3109
public void testCompletionAllocationExpressionIsParent5() throws JavaModelException {
3249
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3110
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3250
			requestor.getResults());
3111
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAllocationExpressionIsParent5.java");
3251
}
3252
public void testCompletionKeywordThis3() throws JavaModelException {
3253
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3254
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis3.java");
3255
3112
3256
		String str = cu.getSource();
3113
	String str = cu.getSource();
3257
		String completeBehind = "thi";
3114
	String completeBehind = "zz";
3258
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3115
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3259
		cu.codeComplete(cursorLocation, requestor);
3116
	cu.codeComplete(cursorLocation, requestor);
3260
3117
3261
		assertEquals(
3118
	assertEquals(
3262
			"",
3119
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3263
			requestor.getResults());
3120
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3121
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3122
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3123
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3124
		requestor.getResults());
3264
}
3125
}
3265
public void testCompletionKeywordThis4() throws JavaModelException {
3266
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3267
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis4.java");
3268
3126
3269
		String str = cu.getSource();
3127
public void testCompletionAllocationExpressionIsParent6() throws JavaModelException {
3270
		String completeBehind = "thi";
3128
	this.wc = getWorkingCopy(
3271
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3129
            "/Completion/src/CompletionAllocationExpressionIsParent6.java",
3272
		cu.codeComplete(cursorLocation, requestor);
3130
            "public class CompletionAllocationExpressionIsParent6 {\n" +
3131
            "	\n" +
3132
            "	long zzlong;\n" +
3133
            "	int zzint;\n" +
3134
            "	double zzdouble;\n" +
3135
            "	boolean zzboolean;\n" +
3136
            "	Object zzObject;\n" +
3137
            "	\n" +
3138
            "	void foo() {\n" +
3139
            "		new CompletionAllocation_ERROR_ExpressionIsParent6Plus().new Inner(1, zz\n" +
3140
            "	}\n" +
3141
            "}\n" +
3142
            "class CompletionAllocationExpressionIsParent6Plus {\n" +
3143
            "	public class Inner {\n" +
3144
            "		public Inner(long i, long j){\n" +
3145
            "			\n" +
3146
            "		}	\n" +
3147
            "	}	\n" +
3148
            "}");
3149
    
3150
    
3151
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3152
    String str = this.wc.getSource();
3153
    String completeBehind = "zz";
3154
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3155
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3273
3156
3274
		assertEquals(
3157
    assertResults(
3275
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3158
            "zzObject[FIELD_REF]{zzObject, LCompletionAllocationExpressionIsParent6;, Ljava.lang.Object;, zzObject, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3276
			requestor.getResults());
3159
            "zzboolean[FIELD_REF]{zzboolean, LCompletionAllocationExpressionIsParent6;, Z, zzboolean, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3160
            "zzdouble[FIELD_REF]{zzdouble, LCompletionAllocationExpressionIsParent6;, D, zzdouble, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3161
            "zzint[FIELD_REF]{zzint, LCompletionAllocationExpressionIsParent6;, I, zzint, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3162
            "zzlong[FIELD_REF]{zzlong, LCompletionAllocationExpressionIsParent6;, J, zzlong, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}",
3163
            requestor.getResults());
3277
}
3164
}
3278
public void testCompletionKeywordThis5() throws JavaModelException {
3279
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3280
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis5.java");
3281
3282
		String str = cu.getSource();
3283
		String completeBehind = "thi";
3284
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3285
		cu.codeComplete(cursorLocation, requestor);
3286
3165
3287
		assertEquals(
3166
public void testCompletionFieldInitializer1() throws JavaModelException {
3288
			"",
3167
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3289
			requestor.getResults());
3168
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer1.java");
3290
}
3291
public void testCompletionKeywordThis6() throws JavaModelException {
3292
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3293
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis6.java");
3294
3169
3295
		String str = cu.getSource();
3170
	String str = cu.getSource();
3296
		String completeBehind = "thi";
3171
	String completeBehind = "zz";
3297
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3172
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3298
		cu.codeComplete(cursorLocation, requestor);
3173
	cu.codeComplete(cursorLocation, requestor);
3299
3174
3300
		assertEquals(
3175
	assertEquals(
3301
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3176
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3302
			requestor.getResults());
3177
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3178
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3179
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3180
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3181
		requestor.getResults());
3303
}
3182
}
3304
public void testCompletionKeywordThis7() throws JavaModelException {
3305
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3306
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis7.java");
3307
3183
3308
		String str = cu.getSource();
3184
public void testCompletionFieldInitializer2() throws JavaModelException {
3309
		String completeBehind = "thi";
3185
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3310
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3186
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer2.java");
3311
		cu.codeComplete(cursorLocation, requestor);
3312
3187
3313
		assertEquals(
3188
	String str = cu.getSource();
3314
			"",
3189
	String completeBehind = "zz";
3315
			requestor.getResults());
3190
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3191
	cu.codeComplete(cursorLocation, requestor);
3192
3193
	assertEquals(
3194
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3195
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3196
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3197
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3198
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3199
		requestor.getResults());
3316
}
3200
}
3317
public void testCompletionKeywordSuper1() throws JavaModelException {
3318
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3319
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper1.java");
3320
3201
3321
		String str = cu.getSource();
3202
public void testCompletionFieldInitializer3() throws JavaModelException {
3322
		String completeBehind = "sup";
3203
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3323
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3204
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer3.java");
3324
		cu.codeComplete(cursorLocation, requestor);
3325
3205
3326
		assertEquals(
3206
	String str = cu.getSource();
3327
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3207
	String completeBehind = "Objec";
3328
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3208
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3329
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3209
	cu.codeComplete(cursorLocation, requestor);
3330
			requestor.getResults());
3210
3211
	assertEquals(
3212
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3213
		requestor.getResults());
3331
}
3214
}
3332
public void testCompletionKeywordSuper2() throws JavaModelException {
3333
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3334
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper2.java");
3335
3215
3336
		String str = cu.getSource();
3216
public void testCompletionFieldInitializer4() throws JavaModelException {
3337
		String completeBehind = "sup";
3217
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3338
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3218
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFieldInitializer4.java");
3339
		cu.codeComplete(cursorLocation, requestor);
3340
3219
3341
		assertEquals(
3220
	String str = cu.getSource();
3342
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3221
	String completeBehind = "Objec";
3343
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3222
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3344
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3223
	cu.codeComplete(cursorLocation, requestor);
3345
			requestor.getResults());
3224
3225
	assertEquals(
3226
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3227
		requestor.getResults());
3346
}
3228
}
3347
public void testCompletionKeywordSuper3() throws JavaModelException {
3229
public void testCompletionVariableInitializerInInitializer1() throws JavaModelException {
3348
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3230
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3349
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper3.java");
3231
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer1.java");
3350
3232
3351
		String str = cu.getSource();
3233
	String str = cu.getSource();
3352
		String completeBehind = "sup";
3234
	String completeBehind = "zz";
3353
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3235
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3354
		cu.codeComplete(cursorLocation, requestor);
3236
	cu.codeComplete(cursorLocation, requestor);
3355
3237
3356
		assertEquals(
3238
	assertEquals(
3357
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3239
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3358
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
3240
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3359
			requestor.getResults());
3241
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3242
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3243
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3244
		requestor.getResults());
3360
}
3245
}
3361
public void testCompletionKeywordSuper4() throws JavaModelException {
3362
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3363
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper4.java");
3364
3246
3365
		String str = cu.getSource();
3247
public void testCompletionVariableInitializerInInitializer2() throws JavaModelException {
3366
		String completeBehind = "sup";
3248
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3367
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3249
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer2.java");
3368
		cu.codeComplete(cursorLocation, requestor);
3369
3250
3370
		assertEquals(
3251
	String str = cu.getSource();
3371
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3252
	String completeBehind = "zz";
3372
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3253
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3373
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3254
	cu.codeComplete(cursorLocation, requestor);
3374
			requestor.getResults());
3255
3256
	assertEquals(
3257
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3258
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3259
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3260
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3261
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3262
		requestor.getResults());
3375
}
3263
}
3376
public void testCompletionKeywordSuper5() throws JavaModelException {
3377
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3378
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper5.java");
3379
3264
3380
		String str = cu.getSource();
3265
public void testCompletionVariableInitializerInInitializer3() throws JavaModelException {
3381
		String completeBehind = "sup";
3266
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3382
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3267
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer3.java");
3383
		cu.codeComplete(cursorLocation, requestor);
3384
3268
3385
		assertEquals(
3269
	String str = cu.getSource();
3386
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
3270
	String completeBehind = "Objec";
3387
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
3271
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3388
			requestor.getResults());
3272
	cu.codeComplete(cursorLocation, requestor);
3389
}
3390
public void testCompletionKeywordSuper6() throws JavaModelException {
3391
	this.wc = getWorkingCopy(
3392
            "/Completion/src2/CompletionKeywordSuper6.java",
3393
            "public class CompletionKeywordSuper6 {\n"+
3394
            "	public CompletionKeywordSuper6() {\n"+
3395
            "		sup\n"+
3396
            "	}\n"+
3397
            "}");
3398
    
3399
    
3400
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3401
    
3402
    String str = this.wc.getSource();
3403
    String completeBehind = "sup";
3404
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3405
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3406
3273
3407
    assertResults(
3274
	assertEquals(
3408
            "expectedTypesSignatures=null\n"+
3275
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3409
            "expectedTypesKeys=null",
3276
		requestor.getResults());
3410
            requestor.getContext());
3411
    
3412
    assertResults(
3413
            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
3414
			"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
3415
			"super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" +
3416
			"super[METHOD_REF<CONSTRUCTOR>]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
3417
			requestor.getResults());
3418
}
3277
}
3419
public void testCompletionKeywordTry1() throws JavaModelException {
3420
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3421
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry1.java");
3422
3278
3423
		String str = cu.getSource();
3279
public void testCompletionVariableInitializerInInitializer4() throws JavaModelException {
3424
		String completeBehind = "tr";
3280
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3425
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3281
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInInitializer4.java");
3426
		cu.codeComplete(cursorLocation, requestor);
3427
3282
3428
		assertEquals(
3283
	String str = cu.getSource();
3429
			"element:try    completion:try    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3284
	String completeBehind = "Objec";
3430
			requestor.getResults());
3285
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3286
	cu.codeComplete(cursorLocation, requestor);
3287
3288
	assertEquals(
3289
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3290
		requestor.getResults());
3431
}
3291
}
3432
public void testCompletionKeywordTry2() throws JavaModelException {
3292
public void testCompletionVariableInitializerInMethod1() throws JavaModelException {
3433
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3293
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3434
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry2.java");
3294
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod1.java");
3435
3295
3436
		String str = cu.getSource();
3296
	String str = cu.getSource();
3437
		String completeBehind = "tr";
3297
	String completeBehind = "zz";
3438
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3298
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3439
		cu.codeComplete(cursorLocation, requestor);
3299
	cu.codeComplete(cursorLocation, requestor);
3440
3300
3441
		assertEquals(
3301
	assertEquals(
3442
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
3302
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3443
			requestor.getResults());
3303
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3304
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3305
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3306
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3307
		requestor.getResults());
3444
}
3308
}
3445
public void testCompletionKeywordTry3() throws JavaModelException {
3446
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3447
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry3.java");
3448
3309
3449
		String str = cu.getSource();
3310
public void testCompletionVariableInitializerInMethod2() throws JavaModelException {
3450
		String completeBehind = "try";
3311
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3451
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3312
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod2.java");
3452
		cu.codeComplete(cursorLocation, requestor);
3453
3313
3454
		assertEquals(
3314
	String str = cu.getSource();
3455
			"",
3315
	String completeBehind = "zz";
3456
			requestor.getResults());
3316
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3317
	cu.codeComplete(cursorLocation, requestor);
3318
3319
	assertEquals(
3320
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3321
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3322
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3323
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3324
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3325
		requestor.getResults());
3457
}
3326
}
3458
public void testCompletionKeywordDo1() throws JavaModelException {
3459
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3460
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo1.java");
3461
3327
3462
		String str = cu.getSource();
3328
public void testCompletionVariableInitializerInMethod3() throws JavaModelException {
3463
		String completeBehind = "do";
3329
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3464
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3330
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod3.java");
3465
		cu.codeComplete(cursorLocation, requestor);
3466
3331
3467
		assertEquals(
3332
	String str = cu.getSource();
3468
			"element:do    completion:do    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+
3333
	String completeBehind = "Objec";
3469
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3334
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3470
			requestor.getResults());
3335
	cu.codeComplete(cursorLocation, requestor);
3336
3337
	assertEquals(
3338
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3339
		requestor.getResults());
3471
}
3340
}
3472
public void testCompletionKeywordDo2() throws JavaModelException {
3473
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3474
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo2.java");
3475
3341
3476
		String str = cu.getSource();
3342
public void testCompletionVariableInitializerInMethod4() throws JavaModelException {
3477
		String completeBehind = "do";
3343
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3478
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3344
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableInitializerInMethod4.java");
3479
		cu.codeComplete(cursorLocation, requestor);
3480
3345
3481
		assertEquals(
3346
	String str = cu.getSource();
3482
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3347
	String completeBehind = "Objec";
3483
			requestor.getResults());
3348
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3349
	cu.codeComplete(cursorLocation, requestor);
3350
3351
	assertEquals(
3352
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3353
		requestor.getResults());
3484
}
3354
}
3485
public void testCompletionKeywordDo3() throws JavaModelException {
3355
public void testCompletionAssignmentInMethod1() throws JavaModelException {
3486
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3356
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3487
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo3.java");
3357
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod1.java");
3488
3358
3489
		String str = cu.getSource();
3359
	String str = cu.getSource();
3490
		String completeBehind = "do";
3360
	String completeBehind = "zz";
3491
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3361
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3492
		cu.codeComplete(cursorLocation, requestor);
3362
	cu.codeComplete(cursorLocation, requestor);
3493
3363
3494
		assertEquals(
3364
	assertEquals(
3495
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3365
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3496
			requestor.getResults());
3366
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3367
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3368
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3369
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3370
		requestor.getResults());
3497
}
3371
}
3498
public void testCompletionKeywordFor1() throws JavaModelException {
3499
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3500
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor1.java");
3501
3372
3502
		String str = cu.getSource();
3373
public void testCompletionAssignmentInMethod2() throws JavaModelException {
3503
		String completeBehind = "fo";
3374
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3504
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3375
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod2.java");
3505
		cu.codeComplete(cursorLocation, requestor);
3506
3376
3507
		assertEquals(
3377
	String str = cu.getSource();
3508
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
3378
	String completeBehind = "zz";
3509
			"element:for    completion:for    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3379
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3510
			requestor.getResults());
3380
	cu.codeComplete(cursorLocation, requestor);
3381
3382
	assertEquals(
3383
		"element:zzObject    completion:zzObject    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3384
		"element:zzboolean    completion:zzboolean    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3385
		"element:zzdouble    completion:zzdouble    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3386
		"element:zzint    completion:zzint    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3387
		"element:zzlong    completion:zzlong    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3388
		requestor.getResults());
3511
}
3389
}
3512
public void testCompletionKeywordFor2() throws JavaModelException {
3513
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3514
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor2.java");
3515
3390
3516
		String str = cu.getSource();
3391
public void testCompletionAssignmentInMethod3() throws JavaModelException {
3517
		String completeBehind = "fo";
3392
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3518
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3393
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod3.java");
3519
		cu.codeComplete(cursorLocation, requestor);
3394
3395
	String str = cu.getSource();
3396
	String completeBehind = "Objec";
3397
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3398
	cu.codeComplete(cursorLocation, requestor);
3520
3399
3521
		assertEquals(
3400
	assertEquals(
3522
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3401
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3523
			requestor.getResults());
3402
		requestor.getResults());
3524
}
3403
}
3525
public void testCompletionKeywordFor3() throws JavaModelException {
3526
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3527
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor3.java");
3528
3404
3529
		String str = cu.getSource();
3405
public void testCompletionAssignmentInMethod4() throws JavaModelException {
3530
		String completeBehind = "fo";
3406
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3531
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3407
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAssignmentInMethod4.java");
3532
		cu.codeComplete(cursorLocation, requestor);
3533
3408
3534
		assertEquals(
3409
	String str = cu.getSource();
3535
			"",
3410
	String completeBehind = "Objec";
3536
			requestor.getResults());
3411
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3412
	cu.codeComplete(cursorLocation, requestor);
3413
3414
	assertEquals(
3415
		"element:Object    completion:Object    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3416
		requestor.getResults());
3537
}
3417
}
3538
public void testCompletionKeywordIf1() throws JavaModelException {
3418
/*
3539
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3419
* http://dev.eclipse.org/bugs/show_bug.cgi?id=24565
3540
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf1.java");
3420
*/
3421
public void testCompletionObjectsMethodWithInterfaceReceiver() throws JavaModelException {
3422
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3423
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionObjectsMethodWithInterfaceReceiver.java");
3541
3424
3542
		String str = cu.getSource();
3425
	String str = cu.getSource();
3543
		String completeBehind = "if";
3426
	String completeBehind = "hash";
3544
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3427
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3545
		cu.codeComplete(cursorLocation, requestor);
3428
	cu.codeComplete(cursorLocation, requestor);
3546
3429
3547
		assertEquals(
3430
	assertEquals(
3548
			"element:if    completion:if    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
3431
		"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
3549
			requestor.getResults());
3432
		requestor.getResults());
3550
}
3433
}
3551
public void testCompletionKeywordIf2() throws JavaModelException {
3434
/*
3552
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3435
* http://dev.eclipse.org/bugs/show_bug.cgi?id=24939
3553
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf2.java");
3436
*/
3437
public void testCompletionConstructorForAnonymousType() throws JavaModelException {
3438
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3439
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConstructorForAnonymousType.java");
3554
3440
3555
		String str = cu.getSource();
3441
	String str = cu.getSource();
3556
		String completeBehind = "if";
3442
	String completeBehind = "TypeWithConstructor(";
3557
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3443
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3558
		cu.codeComplete(cursorLocation, requestor);
3444
	cu.codeComplete(cursorLocation, requestor);
3559
3445
3560
		assertEquals(
3446
	assertEquals(
3561
			"",
3447
		"element:TypeWithConstructor    completion:    relevance:"+(R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED),
3562
			requestor.getResults());
3448
		requestor.getResults());
3563
}
3449
}
3564
public void testCompletionKeywordIf3() throws JavaModelException {
3450
/*
3565
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3451
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
3566
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf3.java");
3452
*/
3567
3453
public void testCompletionEmptyTypeName1() throws JavaModelException {
3568
		String str = cu.getSource();
3454
	this.wc = getWorkingCopy(
3569
		String completeBehind = "if";
3455
            "/Completion/src/CompletionEmptyTypeName1.java",
3570
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3456
            "public class CompletionEmptyTypeName1 {\n"+
3571
		cu.codeComplete(cursorLocation, requestor);
3457
           "	void foo() {\n"+
3458
           "		A a = new \n"+
3459
           "	}\n"+
3460
           "}");
3461
    
3462
    
3463
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3464
    String str = this.wc.getSource();
3465
    String completeBehind = "new ";
3466
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3467
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3572
3468
3573
		assertEquals(
3469
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
3574
			"",
3470
		assertResults(
3471
			"A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
3472
			requestor.getResults());
3473
	} else {
3474
		assertResults(
3475
			"CompletionEmptyTypeName1[TYPE_REF]{CompletionEmptyTypeName1, , LCompletionEmptyTypeName1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED)+"}\n"+
3476
			"A[TYPE_REF]{A, , LA;, null, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
3575
			requestor.getResults());
3477
			requestor.getResults());
3478
	}
3576
}
3479
}
3577
public void testCompletionKeywordReturn1() throws JavaModelException {
3480
/*
3578
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3481
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25221
3579
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn1.java");
3482
*/
3483
public void testCompletionEmptyTypeName2() throws JavaModelException {
3484
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3485
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName2.java");
3580
3486
3581
		String str = cu.getSource();
3487
	String str = cu.getSource();
3582
		String completeBehind = "re";
3488
	String completeBehind = " = ";
3583
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3489
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3584
		cu.codeComplete(cursorLocation, requestor);
3490
	cu.codeComplete(cursorLocation, requestor);
3585
3491
3492
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
3586
		assertEquals(
3493
		assertEquals(
3587
			"element:return    completion:return    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3494
			"element:a    completion:a    relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3495
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3496
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3497
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
3498
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3499
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3500
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3501
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3502
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3503
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3504
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3505
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3506
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3588
			requestor.getResults());
3507
			requestor.getResults());
3589
}
3508
	} else {
3590
public void testCompletionKeywordReturn2() throws JavaModelException {
3591
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3592
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn2.java");
3593
3594
		String str = cu.getSource();
3595
		String completeBehind = "re";
3596
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3597
		cu.codeComplete(cursorLocation, requestor);
3598
3599
		assertEquals(
3509
		assertEquals(
3600
			"",
3510
			"element:A    completion:A    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3511
			"element:CompletionEmptyTypeName2    completion:CompletionEmptyTypeName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3512
			"element:a    completion:a    relevance:"+(R_DEFAULT + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3513
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3514
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3515
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
3516
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3517
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3518
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3519
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3520
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3521
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3522
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3523
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3524
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3601
			requestor.getResults());
3525
			requestor.getResults());
3526
	}
3602
}
3527
}
3603
public void testCompletionKeywordReturn3() throws JavaModelException {
3528
/*
3604
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3529
* http://dev.eclipse.org/bugs/show_bug.cgi?id=41643
3605
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn3.java");
3530
*/
3531
public void testCompletionEmptyTypeName3() throws JavaModelException {
3532
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3533
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyTypeName3.java");
3606
3534
3607
		String str = cu.getSource();
3535
	String str = cu.getSource();
3608
		String completeBehind = "re";
3536
	String completeBehind = " = ";
3609
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3537
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3610
		cu.codeComplete(cursorLocation, requestor);
3538
	cu.codeComplete(cursorLocation, requestor);
3611
3539
3540
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
3612
		assertEquals(
3541
		assertEquals(
3613
			"",
3542
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3543
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3544
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
3545
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3546
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3547
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3548
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3549
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3550
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3551
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3552
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3553
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3554
			"element:x    completion:x    relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
3614
			requestor.getResults());
3555
			requestor.getResults());
3615
}
3556
	} else {
3616
public void testCompletionKeywordSwitch1() throws JavaModelException {
3617
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3618
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch1.java");
3619
3620
		String str = cu.getSource();
3621
		String completeBehind = "sw";
3622
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3623
		cu.codeComplete(cursorLocation, requestor);
3624
3625
		assertEquals(
3557
		assertEquals(
3626
			"element:switch    completion:switch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3558
			"element:CompletionEmptyTypeName2    completion:CompletionEmptyTypeName2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3559
			"element:CompletionEmptyTypeName3    completion:CompletionEmptyTypeName3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3560
			"element:CompletionEmptyTypeName3.CompletionEmptyTypeName3_1    completion:CompletionEmptyTypeName3_1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3561
			"element:CompletionEmptyTypeName3_2    completion:CompletionEmptyTypeName3_2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3562
			"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3563
			"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3564
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +		
3565
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3566
			"element:getClass    completion:getClass()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3567
			"element:hashCode    completion:hashCode()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3568
			"element:notify    completion:notify()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3569
			"element:notifyAll    completion:notifyAll()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3570
			"element:toString    completion:toString()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3571
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3572
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3573
			"element:wait    completion:wait()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3574
			"element:x    completion:x    relevance:"+(R_DEFAULT + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
3627
			requestor.getResults());
3575
			requestor.getResults());
3576
	}
3628
}
3577
}
3629
public void testCompletionKeywordSwitch2() throws JavaModelException {
3578
/*
3630
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3579
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
3631
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch2.java");
3580
*/
3632
3581
public void testCompletionAbstractMethodRelevance1() throws JavaModelException {
3633
		String str = cu.getSource();
3582
	ICompilationUnit superClass = null;
3634
		String completeBehind = "sw";
3583
	try {
3635
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3584
		superClass = getWorkingCopy(
3636
		cu.codeComplete(cursorLocation, requestor);
3585
	            "/Completion/src/CompletionAbstractSuperClass.java",
3637
3586
	            "public abstract class CompletionAbstractSuperClass {\n"+
3638
		assertEquals(
3587
	            "	public void foo1(){}\n"+
3639
			"",
3588
	            "	public abstract void foo2();\n"+
3589
	            "	public void foo3(){}\n"+
3590
	            "}");
3591
		
3592
		this.wc = getWorkingCopy(
3593
	            "/Completion/src/CompletionAbstractMethodRelevance1.java",
3594
	            "public class CompletionAbstractMethodRelevance1 extends CompletionAbstractSuperClass {\n"+
3595
	            "	foo\n"+
3596
	            "}");
3597
	    
3598
	    
3599
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3600
	    String str = this.wc.getSource();
3601
	    String completeBehind = "foo";
3602
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3603
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3604
	
3605
		assertResults(
3606
			"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionAbstractMethodRelevance1;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
3607
			"foo1[METHOD_DECLARATION]{public void foo1(), LCompletionAbstractSuperClass;, ()V, foo1, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
3608
			"foo3[METHOD_DECLARATION]{public void foo3(), LCompletionAbstractSuperClass;, ()V, foo3, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
3609
			"foo2[METHOD_DECLARATION]{public void foo2(), LCompletionAbstractSuperClass;, ()V, foo2, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
3640
			requestor.getResults());
3610
			requestor.getResults());
3611
	} finally {
3612
		if(superClass != null) {
3613
			superClass.discardWorkingCopy();
3614
		}
3615
	}
3641
}
3616
}
3642
public void testCompletionKeywordSwitch3() throws JavaModelException {
3617
/*
3643
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3618
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25578
3644
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch3.java");
3619
*/
3645
3620
public void testCompletionAbstractMethodRelevance2() throws JavaModelException {
3646
		String str = cu.getSource();
3621
	ICompilationUnit superClass = null;
3647
		String completeBehind = "sw";
3622
	try {
3648
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3623
		superClass = getWorkingCopy(
3649
		cu.codeComplete(cursorLocation, requestor);
3624
	            "/Completion/src/CompletionSuperInterface.java",
3650
3625
	            "public interface CompletionSuperInterface{\n"+
3651
		assertEquals(
3626
	            "	public int eqFoo(int a,Object b);\n"+
3652
			"",
3627
	            "}");
3628
		
3629
		this.wc = getWorkingCopy(
3630
	            "/Completion/src/CompletionAbstractMethodRelevance2.java",
3631
	            "public class CompletionAbstractMethodRelevance2 implements CompletionSuperInterface {\n"+
3632
	            "	eq\n"+
3633
	            "}");
3634
	    
3635
	    
3636
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3637
	    String str = this.wc.getSource();
3638
	    String completeBehind = "eq";
3639
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3640
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3641
	
3642
		assertResults(
3643
			"eq[POTENTIAL_METHOD_DECLARATION]{eq, LCompletionAbstractMethodRelevance2;, ()V, eq, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n" +
3644
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED)+"}\n" +
3645
			"eqFoo[METHOD_DECLARATION]{public int eqFoo(int a, Object b), LCompletionSuperInterface;, (ILjava.lang.Object;)I, eqFoo, (a, b), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_ABSTRACT_METHOD + R_METHOD_OVERIDE+ R_NON_RESTRICTED)+"}",
3653
			requestor.getResults());
3646
			requestor.getResults());
3647
	} finally {
3648
		if(superClass != null) {
3649
			superClass.discardWorkingCopy();
3650
		}
3651
	}
3654
}
3652
}
3655
public void testCompletionKeywordThrow1() throws JavaModelException {
3653
/*
3656
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3654
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25591
3657
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow1.java");
3655
*/
3656
public void testCompletionReturnInInitializer() throws JavaModelException {
3657
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3658
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionReturnInInitializer.java");
3658
3659
3659
		String str = cu.getSource();
3660
	String str = cu.getSource();
3660
		String completeBehind = "thr";
3661
	String completeBehind = "eq";
3661
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3662
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3662
		cu.codeComplete(cursorLocation, requestor);
3663
	cu.codeComplete(cursorLocation, requestor);
3663
3664
3664
		assertEquals(
3665
	assertEquals(
3665
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
3666
		"element:equals    completion:equals()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3666
			"element:throw    completion:throw    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3667
		requestor.getResults());
3667
			requestor.getResults());
3668
}
3668
}
3669
public void testCompletionKeywordThrow2() throws JavaModelException {
3669
/*
3670
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3670
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
3671
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow2.java");
3671
*/
3672
public void testCompletionVariableName1() throws JavaModelException {
3673
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3674
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName1.java");
3672
3675
3673
		String str = cu.getSource();
3676
	String str = cu.getSource();
3674
		String completeBehind = "thr";
3677
	String completeBehind = "TEST_FOO_MyClass ";
3675
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3678
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3676
		cu.codeComplete(cursorLocation, requestor);
3679
	cu.codeComplete(cursorLocation, requestor);
3677
3680
3678
		assertEquals(
3681
	assertEquals(
3679
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
3682
		"element:class1    completion:class1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3680
			requestor.getResults());
3683
		"element:myClass    completion:myClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3684
		requestor.getResults());
3681
}
3685
}
3682
public void testCompletionKeywordThrow3() throws JavaModelException {
3686
/*
3683
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3687
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25811
3684
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow3.java");
3688
*/
3689
public void testCompletionVariableName2() throws JavaModelException {
3690
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3691
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName2.java");
3685
3692
3686
		String str = cu.getSource();
3693
	String str = cu.getSource();
3687
		String completeBehind = "thr";
3694
	String completeBehind = "Test_Bar_MyClass ";
3688
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3695
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3689
		cu.codeComplete(cursorLocation, requestor);
3696
	cu.codeComplete(cursorLocation, requestor);
3690
3697
3691
		assertEquals(
3698
	assertEquals(
3692
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
3699
		"element:bar_MyClass    completion:bar_MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3693
			requestor.getResults());
3700
		"element:class1    completion:class1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3701
		"element:myClass    completion:myClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3702
		"element:test_Bar_MyClass    completion:test_Bar_MyClass    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3703
		requestor.getResults());
3694
}
3704
}
3695
public void testCompletionKeywordAssert1() throws JavaModelException {
3705
/*
3696
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3706
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25820
3697
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert1.java");
3707
*/
3708
public void testCompletionExpectedTypeIsNotValid() throws JavaModelException {
3709
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3710
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExpectedTypeIsNotValid.java");
3698
3711
3699
		String str = cu.getSource();
3712
	String str = cu.getSource();
3700
		String completeBehind = "as";
3713
	String completeBehind = "new U";
3701
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3714
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3702
		cu.codeComplete(cursorLocation, requestor);
3715
	cu.codeComplete(cursorLocation, requestor);
3703
3716
3704
		assertEquals(
3717
	assertEquals(
3705
			"element:assert    completion:assert    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3718
		"",
3706
			requestor.getResults());
3719
		requestor.getResults());
3707
}
3720
}
3708
public void testCompletionKeywordAssert2() throws JavaModelException {
3721
/*
3709
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3722
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
3710
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert2.java");
3723
*/
3711
3724
public void testCompletionMemberType() throws JavaModelException {
3712
		String str = cu.getSource();
3725
	this.wc = getWorkingCopy(
3713
		String completeBehind = "as";
3726
            "/Completion/src/CompletionMemberType.java",
3714
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3727
            "public class CompletionMemberType {\n"+
3715
		cu.codeComplete(cursorLocation, requestor);
3728
            "	public class Y {\n"+
3729
            "		public void foo(){\n"+
3730
            "			Y var = new Y\n"+
3731
            "		}\n"+
3732
            "	}\n"+
3733
            "}");
3734
    
3735
    
3736
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3737
    String str = this.wc.getSource();
3738
    String completeBehind = "new Y";
3739
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3740
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3716
3741
3717
		assertEquals(
3742
    assertResults(
3718
			"",
3743
		"CompletionMemberType.Y[TYPE_REF]{Y, , LCompletionMemberType$Y;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
3719
			requestor.getResults());
3744
		requestor.getResults());
3720
}
3745
}
3721
public void testCompletionKeywordAssert3() throws JavaModelException {
3746
/*
3722
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3747
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25815
3723
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert3.java");
3748
*/
3749
public void testCompletionVoidMethod() throws JavaModelException {
3750
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3751
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVoidMethod.java");
3724
3752
3725
		String str = cu.getSource();
3753
	String str = cu.getSource();
3726
		String completeBehind = "as";
3754
	String completeBehind = "foo";
3727
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3755
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3728
		cu.codeComplete(cursorLocation, requestor);
3756
	cu.codeComplete(cursorLocation, requestor);
3729
3757
3730
		assertEquals(
3758
	assertEquals(
3731
			"",
3759
		"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3732
			requestor.getResults());
3760
		"element:foo1    completion:foo1()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3761
		"element:foo3    completion:foo3()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3762
		requestor.getResults());
3733
}
3763
}
3734
public void testCompletionKeywordElse1() throws JavaModelException {
3764
/*
3765
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
3766
*/
3767
public void testCompletionOnStaticMember1() throws JavaModelException {
3735
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3768
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3736
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse1.java");
3769
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember1.java");
3737
3770
3738
		String str = cu.getSource();
3771
		String str = cu.getSource();
3739
		String completeBehind = "els";
3772
		String completeBehind = "var";
3740
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3773
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3741
		cu.codeComplete(cursorLocation, requestor);
3774
		cu.codeComplete(cursorLocation, requestor);
3742
3775
3743
		assertEquals(
3776
		assertEquals(
3744
			"element:else    completion:else    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3777
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3778
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
3745
			requestor.getResults());
3779
			requestor.getResults());
3746
}
3780
}
3747
public void testCompletionKeywordElse2() throws JavaModelException {
3781
/*
3782
* http://dev.eclipse.org/bugs/show_bug.cgi?id=25890
3783
*/
3784
public void testCompletionOnStaticMember2() throws JavaModelException {
3748
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3785
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3749
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse2.java");
3786
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionOnStaticMember2.java");
3750
3787
3751
		String str = cu.getSource();
3788
		String str = cu.getSource();
3752
		String completeBehind = "els";
3789
		String completeBehind = "method";
3753
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3790
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3754
		cu.codeComplete(cursorLocation, requestor);
3791
		cu.codeComplete(cursorLocation, requestor);
3755
3792
3756
		assertEquals(
3793
		assertEquals(
3757
			"",
3794
			"element:method1    completion:method1()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n" +
3795
			"element:method2    completion:method2()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
3758
			requestor.getResults());
3796
			requestor.getResults());
3759
}
3797
}
3760
public void testCompletionKeywordElse3() throws JavaModelException {
3798
/*
3799
* http://dev.eclipse.org/bugs/show_bug.cgi?id=26677
3800
*/
3801
public void testCompletionQualifiedExpectedType() throws JavaModelException {
3802
	this.wc = getWorkingCopy(
3803
            "/Completion/src/test/CompletionQualifiedExpectedType.java",
3804
            "import pack1.PX;\n"+
3805
            "\n"+
3806
            "public class CompletionQualifiedExpectedType {\n"+
3807
            "	void foo() {\n"+
3808
            "		pack2.PX var = new \n"+
3809
            "	}\n"+
3810
            "}");
3811
    
3812
    
3813
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
3814
    String str = this.wc.getSource();
3815
    String completeBehind = "new ";
3816
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3817
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
3818
3819
    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
3820
    	assertResults(
3821
	            "PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}",
3822
				requestor.getResults());
3823
    } else {
3824
	    assertResults(
3825
	            "CompletionQualifiedExpectedType[TYPE_REF]{CompletionQualifiedExpectedType, test, Ltest.CompletionQualifiedExpectedType;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
3826
				"PX[TYPE_REF]{pack2.PX, pack2, Lpack2.PX;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED)+ "}",
3827
				requestor.getResults());
3828
    }
3829
}
3830
public void testCompletionUnaryOperator1() throws JavaModelException {
3761
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3831
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3762
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse3.java");
3832
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator1.java");
3763
3833
3764
		String str = cu.getSource();
3834
		String str = cu.getSource();
3765
		String completeBehind = "els";
3835
		String completeBehind = "var";
3766
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3836
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3767
		cu.codeComplete(cursorLocation, requestor);
3837
		cu.codeComplete(cursorLocation, requestor);
3768
3838
3769
		assertEquals(
3839
		assertEquals(
3770
			"",
3840
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3841
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3842
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3771
			requestor.getResults());
3843
			requestor.getResults());
3772
}
3844
}
3773
public void testCompletionKeywordElse4() throws JavaModelException {
3845
public void testCompletionUnaryOperator2() throws JavaModelException {
3774
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3846
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3775
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse4.java");
3847
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionUnaryOperator2.java");
3776
3848
3777
		String str = cu.getSource();
3849
		String str = cu.getSource();
3778
		String completeBehind = "els";
3850
		String completeBehind = "var";
3779
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3851
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3780
		cu.codeComplete(cursorLocation, requestor);
3852
		cu.codeComplete(cursorLocation, requestor);
3781
3853
3782
		assertEquals(
3854
		assertEquals(
3783
			"",
3855
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3856
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3857
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3784
			requestor.getResults());
3858
			requestor.getResults());
3785
}
3859
}
3786
public void testCompletionKeywordCatch1() throws JavaModelException {
3860
public void testCompletionBinaryOperator1() throws JavaModelException {
3787
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3861
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3788
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch1.java");
3862
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator1.java");
3789
3863
3790
		String str = cu.getSource();
3864
		String str = cu.getSource();
3791
		String completeBehind = "cat";
3865
		String completeBehind = "var";
3792
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3866
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3793
		cu.codeComplete(cursorLocation, requestor);
3867
		cu.codeComplete(cursorLocation, requestor);
3794
3868
3795
		assertEquals(
3869
		assertEquals(
3796
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3870
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3871
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3872
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3873
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE+ R_NON_RESTRICTED),
3797
			requestor.getResults());
3874
			requestor.getResults());
3798
}
3875
}
3799
public void testCompletionKeywordCatch2() throws JavaModelException {
3876
public void testCompletionBinaryOperator2() throws JavaModelException {
3800
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3877
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3801
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch2.java");
3878
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator2.java");
3802
3879
3803
		String str = cu.getSource();
3880
		String str = cu.getSource();
3804
		String completeBehind = "cat";
3881
		String completeBehind = "var";
3805
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3882
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3806
		cu.codeComplete(cursorLocation, requestor);
3883
		cu.codeComplete(cursorLocation, requestor);
3807
3884
3808
		assertEquals(
3885
		assertEquals(
3809
			"",
3886
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3887
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3888
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3810
			requestor.getResults());
3889
			requestor.getResults());
3811
}
3890
}
3812
public void testCompletionKeywordCatch3() throws JavaModelException {
3891
public void testCompletionBinaryOperator3() throws JavaModelException {
3813
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3892
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3814
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch3.java");
3893
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBinaryOperator3.java");
3815
3894
3816
		String str = cu.getSource();
3895
		String str = cu.getSource();
3817
		String completeBehind = "cat";
3896
		String completeBehind = "var";
3818
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3897
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3819
		cu.codeComplete(cursorLocation, requestor);
3898
		cu.codeComplete(cursorLocation, requestor);
3820
3899
3821
		assertEquals(
3900
		assertEquals(
3822
			"",
3901
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3902
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3903
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3823
			requestor.getResults());
3904
			requestor.getResults());
3824
}
3905
}
3825
public void testCompletionKeywordCatch4() throws JavaModelException {
3906
public void testCompletionInstanceofOperator1() throws JavaModelException {
3826
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3907
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3827
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch4.java");
3908
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInstanceofOperator1.java");
3828
3909
3829
		String str = cu.getSource();
3910
		String str = cu.getSource();
3830
		String completeBehind = "cat";
3911
		String completeBehind = "x instanceof WWWCompletionInstanceof";
3831
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3912
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3832
		cu.codeComplete(cursorLocation, requestor);
3913
		cu.codeComplete(cursorLocation, requestor);
3833
3914
3834
		assertEquals(
3915
		assertEquals(
3835
			"",
3916
			"element:WWWCompletionInstanceof1    completion:WWWCompletionInstanceof1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3917
			"element:WWWCompletionInstanceof2    completion:WWWCompletionInstanceof2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3918
			"element:WWWCompletionInstanceof3    completion:WWWCompletionInstanceof3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3919
			"element:WWWCompletionInstanceof4    completion:WWWCompletionInstanceof4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3836
			requestor.getResults());
3920
			requestor.getResults());
3837
}
3921
}
3838
public void testCompletionKeywordCatch5() throws JavaModelException {
3922
public void testCompletionConditionalExpression1() throws JavaModelException {
3839
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3923
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3840
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch5.java");
3924
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression1.java");
3841
3925
3842
		String str = cu.getSource();
3926
		String str = cu.getSource();
3843
		String completeBehind = "cat";
3927
		String completeBehind = "var";
3844
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3928
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3845
		cu.codeComplete(cursorLocation, requestor);
3929
		cu.codeComplete(cursorLocation, requestor);
3846
3930
3847
		assertEquals(
3931
		assertEquals(
3848
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
3932
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3849
			"element:catchz    completion:catchz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3933
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3934
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3935
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3850
			requestor.getResults());
3936
			requestor.getResults());
3851
}
3937
}
3852
public void testCompletionKeywordFinally1() throws JavaModelException {
3938
public void testCompletionConditionalExpression2() throws JavaModelException {
3853
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3939
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3854
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally1.java");
3940
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression2.java");
3855
3941
3856
		String str = cu.getSource();
3942
		String str = cu.getSource();
3857
		String completeBehind = "finall";
3943
		String completeBehind = "var";
3858
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3944
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3859
		cu.codeComplete(cursorLocation, requestor);
3945
		cu.codeComplete(cursorLocation, requestor);
3860
3946
3861
		assertEquals(
3947
		assertEquals(
3862
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3948
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3949
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3950
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3951
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3863
			requestor.getResults());
3952
			requestor.getResults());
3864
}
3953
}
3865
public void testCompletionKeywordFinally2() throws JavaModelException {
3954
public void testCompletionConditionalExpression3() throws JavaModelException {
3866
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3955
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3867
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally2.java");
3956
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionConditionalExpression3.java");
3868
3957
3869
		String str = cu.getSource();
3958
		String str = cu.getSource();
3870
		String completeBehind = "finall";
3959
		String completeBehind = "var";
3871
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3960
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3872
		cu.codeComplete(cursorLocation, requestor);
3961
		cu.codeComplete(cursorLocation, requestor);
3873
3962
3874
		assertEquals(
3963
		assertEquals(
3875
			"",
3964
			"element:var1    completion:var1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"\n" +
3965
			"element:var2    completion:var2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3966
			"element:var3    completion:var3    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n" +
3967
			"element:var4    completion:var4    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3876
			requestor.getResults());
3968
			requestor.getResults());
3877
}
3969
}
3878
public void testCompletionKeywordFinally3() throws JavaModelException {
3970
public void testCompletionKeywordThis1() throws JavaModelException {
3879
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3971
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3880
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally3.java");
3972
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis1.java");
3881
3973
3882
		String str = cu.getSource();
3974
		String str = cu.getSource();
3883
		String completeBehind = "finall";
3975
		String completeBehind = "thi";
3884
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3976
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3885
		cu.codeComplete(cursorLocation, requestor);
3977
		cu.codeComplete(cursorLocation, requestor);
3886
3978
3887
		assertEquals(
3979
		assertEquals(
3888
			"",
3980
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3889
			requestor.getResults());
3981
			requestor.getResults());
3890
}
3982
}
3891
public void testCompletionKeywordFinally4() throws JavaModelException {
3983
public void testCompletionKeywordThis2() throws JavaModelException {
3892
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3984
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3893
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally4.java");
3985
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis2.java");
3894
3986
3895
		String str = cu.getSource();
3987
		String str = cu.getSource();
3896
		String completeBehind = "finall";
3988
		String completeBehind = "thi";
3897
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3989
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3898
		cu.codeComplete(cursorLocation, requestor);
3990
		cu.codeComplete(cursorLocation, requestor);
3899
3991
3900
		assertEquals(
3992
		assertEquals(
3901
			"",
3993
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3902
			requestor.getResults());
3994
			requestor.getResults());
3903
}
3995
}
3904
public void testCompletionKeywordFinally5() throws JavaModelException {
3996
public void testCompletionKeywordThis3() throws JavaModelException {
3905
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3997
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3906
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally5.java");
3998
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis3.java");
3907
3999
3908
		String str = cu.getSource();
4000
		String str = cu.getSource();
3909
		String completeBehind = "finall";
4001
		String completeBehind = "thi";
3910
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4002
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3911
		cu.codeComplete(cursorLocation, requestor);
4003
		cu.codeComplete(cursorLocation, requestor);
3912
4004
3913
		assertEquals(
4005
		assertEquals(
3914
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4006
			"",
3915
			requestor.getResults());
4007
			requestor.getResults());
3916
}
4008
}
3917
public void testCompletionKeywordFinally6() throws JavaModelException {
4009
public void testCompletionKeywordThis4() throws JavaModelException {
3918
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4010
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3919
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally6.java");
4011
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis4.java");
3920
4012
3921
		String str = cu.getSource();
4013
		String str = cu.getSource();
3922
		String completeBehind = "finall";
4014
		String completeBehind = "thi";
3923
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4015
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3924
		cu.codeComplete(cursorLocation, requestor);
4016
		cu.codeComplete(cursorLocation, requestor);
3925
4017
3926
		assertEquals(
4018
		assertEquals(
3927
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
4019
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3928
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
3929
			requestor.getResults());
4020
			requestor.getResults());
3930
}
4021
}
3931
public void testCompletionKeywordFinally7() throws JavaModelException {
4022
public void testCompletionKeywordThis5() throws JavaModelException {
3932
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4023
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3933
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally7.java");
4024
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis5.java");
3934
4025
3935
		String str = cu.getSource();
4026
		String str = cu.getSource();
3936
		String completeBehind = "finall";
4027
		String completeBehind = "thi";
3937
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4028
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3938
		cu.codeComplete(cursorLocation, requestor);
4029
		cu.codeComplete(cursorLocation, requestor);
3939
4030
3940
		assertEquals(
4031
		assertEquals(
3941
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
4032
			"",
3942
			requestor.getResults());
4033
			requestor.getResults());
3943
}
4034
}
3944
public void testCompletionKeywordContinue1() throws JavaModelException {
4035
public void testCompletionKeywordThis6() throws JavaModelException {
3945
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4036
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3946
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue1.java");
4037
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis6.java");
3947
4038
3948
		String str = cu.getSource();
4039
		String str = cu.getSource();
3949
		String completeBehind = "cont";
4040
		String completeBehind = "thi";
3950
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4041
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3951
		cu.codeComplete(cursorLocation, requestor);
4042
		cu.codeComplete(cursorLocation, requestor);
3952
4043
3953
		assertEquals(
4044
		assertEquals(
3954
			"element:continue    completion:continue    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4045
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3955
			requestor.getResults());
4046
			requestor.getResults());
3956
}
4047
}
3957
public void testCompletionKeywordContinue2() throws JavaModelException {
4048
public void testCompletionKeywordThis7() throws JavaModelException {
3958
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4049
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3959
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue2.java");
4050
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis7.java");
3960
4051
3961
		String str = cu.getSource();
4052
		String str = cu.getSource();
3962
		String completeBehind = "cont";
4053
		String completeBehind = "thi";
3963
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4054
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3964
		cu.codeComplete(cursorLocation, requestor);
4055
		cu.codeComplete(cursorLocation, requestor);
3965
4056
Lines 3967-4199 Link Here
3967
			"",
4058
			"",
3968
			requestor.getResults());
4059
			requestor.getResults());
3969
}
4060
}
3970
public void testCompletionKeywordBreak1() throws JavaModelException {
4061
public void testCompletionKeywordSuper1() throws JavaModelException {
3971
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4062
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3972
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak1.java");
4063
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper1.java");
3973
4064
3974
		String str = cu.getSource();
4065
		String str = cu.getSource();
3975
		String completeBehind = "bre";
4066
		String completeBehind = "sup";
3976
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4067
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3977
		cu.codeComplete(cursorLocation, requestor);
4068
		cu.codeComplete(cursorLocation, requestor);
3978
4069
3979
		assertEquals(
4070
		assertEquals(
3980
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4071
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4072
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4073
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3981
			requestor.getResults());
4074
			requestor.getResults());
3982
}
4075
}
3983
public void testCompletionKeywordBreak2() throws JavaModelException {
4076
public void testCompletionKeywordSuper2() throws JavaModelException {
3984
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4077
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3985
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak2.java");
4078
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper2.java");
3986
4079
3987
		String str = cu.getSource();
4080
		String str = cu.getSource();
3988
		String completeBehind = "bre";
4081
		String completeBehind = "sup";
3989
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4082
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
3990
		cu.codeComplete(cursorLocation, requestor);
4083
		cu.codeComplete(cursorLocation, requestor);
3991
4084
3992
		assertEquals(
4085
		assertEquals(
3993
			"",
4086
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4087
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4088
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
3994
			requestor.getResults());
4089
			requestor.getResults());
3995
}
4090
}
3996
public void testCompletionKeywordBreak3() throws JavaModelException {
4091
public void testCompletionKeywordSuper3() throws JavaModelException {
3997
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4092
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
3998
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak3.java");
4093
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper3.java");
3999
4094
4000
		String str = cu.getSource();
4095
		String str = cu.getSource();
4001
		String completeBehind = "bre";
4096
		String completeBehind = "sup";
4002
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4097
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4003
		cu.codeComplete(cursorLocation, requestor);
4098
		cu.codeComplete(cursorLocation, requestor);
4004
4099
4005
		assertEquals(
4100
		assertEquals(
4006
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4101
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4102
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4007
			requestor.getResults());
4103
			requestor.getResults());
4008
}
4104
}
4009
public void testCompletionKeywordWhile1() throws JavaModelException {
4105
public void testCompletionKeywordSuper4() throws JavaModelException {
4010
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4106
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4011
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile1.java");
4107
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper4.java");
4012
4108
4013
		String str = cu.getSource();
4109
		String str = cu.getSource();
4014
		String completeBehind = "wh";
4110
		String completeBehind = "sup";
4015
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4111
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4016
		cu.codeComplete(cursorLocation, requestor);
4112
		cu.codeComplete(cursorLocation, requestor);
4017
4113
4018
		assertEquals(
4114
		assertEquals(
4019
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4115
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4116
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4117
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4020
			requestor.getResults());
4118
			requestor.getResults());
4021
}
4119
}
4022
public void testCompletionKeywordWhile2() throws JavaModelException {
4120
public void testCompletionKeywordSuper5() throws JavaModelException {
4023
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4121
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4024
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile2.java");
4122
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper5.java");
4025
4123
4026
		String str = cu.getSource();
4124
		String str = cu.getSource();
4027
		String completeBehind = "wh";
4125
		String completeBehind = "sup";
4028
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4126
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4029
		cu.codeComplete(cursorLocation, requestor);
4127
		cu.codeComplete(cursorLocation, requestor);
4030
4128
4031
		assertEquals(
4129
		assertEquals(
4032
			"",
4130
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
4131
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4033
			requestor.getResults());
4132
			requestor.getResults());
4034
}
4133
}
4035
public void testCompletionKeywordWhile3() throws JavaModelException {
4134
public void testCompletionKeywordSuper6() throws JavaModelException {
4036
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4135
	this.wc = getWorkingCopy(
4037
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile3.java");
4136
            "/Completion/src2/CompletionKeywordSuper6.java",
4038
4137
            "public class CompletionKeywordSuper6 {\n"+
4039
		String str = cu.getSource();
4138
            "	public CompletionKeywordSuper6() {\n"+
4040
		String completeBehind = "wh";
4139
            "		sup\n"+
4041
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4140
            "	}\n"+
4042
		cu.codeComplete(cursorLocation, requestor);
4141
            "}");
4142
    
4143
    
4144
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
4145
    
4146
    String str = this.wc.getSource();
4147
    String completeBehind = "sup";
4148
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4149
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
4043
4150
4044
		assertEquals(
4151
    assertResults(
4045
			"",
4152
            "expectedTypesSignatures=null\n"+
4153
            "expectedTypesKeys=null",
4154
            requestor.getContext());
4155
    
4156
    assertResults(
4157
            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
4158
			"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
4159
			"super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" +
4160
			"super[METHOD_REF<CONSTRUCTOR>]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
4046
			requestor.getResults());
4161
			requestor.getResults());
4047
}
4162
}
4048
public void testCompletionKeywordWhile4() throws JavaModelException {
4163
public void testCompletionKeywordTry1() throws JavaModelException {
4049
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4164
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4050
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile4.java");
4165
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry1.java");
4051
4166
4052
		String str = cu.getSource();
4167
		String str = cu.getSource();
4053
		String completeBehind = "wh";
4168
		String completeBehind = "tr";
4054
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4169
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4055
		cu.codeComplete(cursorLocation, requestor);
4170
		cu.codeComplete(cursorLocation, requestor);
4056
4171
4057
		assertEquals(
4172
		assertEquals(
4058
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4173
			"element:try    completion:try    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4059
			requestor.getResults());
4174
			requestor.getResults());
4060
}
4175
}
4061
public void testCompletionKeywordWhile5() throws JavaModelException {
4176
public void testCompletionKeywordTry2() throws JavaModelException {
4062
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4177
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4063
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile5.java");
4178
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry2.java");
4064
4179
4065
		String str = cu.getSource();
4180
		String str = cu.getSource();
4066
		String completeBehind = "wh";
4181
		String completeBehind = "tr";
4067
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4182
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4068
		cu.codeComplete(cursorLocation, requestor);
4183
		cu.codeComplete(cursorLocation, requestor);
4069
4184
4070
		assertEquals(
4185
		assertEquals(
4071
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4186
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
4072
			requestor.getResults());
4187
			requestor.getResults());
4073
}
4188
}
4074
public void testCompletionKeywordExtends1() throws JavaModelException {
4189
public void testCompletionKeywordTry3() throws JavaModelException {
4075
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4190
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4076
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends1.java");
4191
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry3.java");
4077
4192
4078
		String str = cu.getSource();
4193
		String str = cu.getSource();
4079
		String completeBehind = "ext";
4194
		String completeBehind = "try";
4080
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4195
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4081
		cu.codeComplete(cursorLocation, requestor);
4196
		cu.codeComplete(cursorLocation, requestor);
4082
4197
4083
		assertEquals(
4198
		assertEquals(
4084
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4199
			"",
4085
			requestor.getResults());
4200
			requestor.getResults());
4086
}
4201
}
4087
public void testCompletionKeywordExtends2() throws JavaModelException {
4202
public void testCompletionKeywordDo1() throws JavaModelException {
4088
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4203
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4089
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends2.java");
4204
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo1.java");
4090
4205
4091
		String str = cu.getSource();
4206
		String str = cu.getSource();
4092
		String completeBehind = "ext";
4207
		String completeBehind = "do";
4093
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4208
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4094
		cu.codeComplete(cursorLocation, requestor);
4209
		cu.codeComplete(cursorLocation, requestor);
4095
4210
4096
		assertEquals(
4211
		assertEquals(
4097
			"",
4212
			"element:do    completion:do    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+
4213
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4098
			requestor.getResults());
4214
			requestor.getResults());
4099
}
4215
}
4100
public void testCompletionKeywordExtends3() throws JavaModelException {
4216
public void testCompletionKeywordDo2() throws JavaModelException {
4101
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4217
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4102
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends3.java");
4218
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo2.java");
4103
4219
4104
		String str = cu.getSource();
4220
		String str = cu.getSource();
4105
		String completeBehind = "ext";
4221
		String completeBehind = "do";
4106
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4222
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4107
		cu.codeComplete(cursorLocation, requestor);
4223
		cu.codeComplete(cursorLocation, requestor);
4108
4224
4109
		assertEquals(
4225
		assertEquals(
4110
			"",
4226
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4111
			requestor.getResults());
4227
			requestor.getResults());
4112
}
4228
}
4113
public void testCompletionKeywordExtends4() throws JavaModelException {
4229
public void testCompletionKeywordDo3() throws JavaModelException {
4114
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4230
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4115
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends4.java");
4231
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo3.java");
4116
4232
4117
		String str = cu.getSource();
4233
		String str = cu.getSource();
4118
		String completeBehind = "ext";
4234
		String completeBehind = "do";
4119
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4235
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4120
		cu.codeComplete(cursorLocation, requestor);
4236
		cu.codeComplete(cursorLocation, requestor);
4121
4237
4122
		assertEquals(
4238
		assertEquals(
4123
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4239
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4124
			requestor.getResults());
4240
			requestor.getResults());
4125
}
4241
}
4126
public void testCompletionKeywordExtends5() throws JavaModelException {
4242
public void testCompletionKeywordFor1() throws JavaModelException {
4127
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4243
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4128
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends5.java");
4244
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor1.java");
4129
4245
4130
		String str = cu.getSource();
4246
		String str = cu.getSource();
4131
		String completeBehind = "ext";
4247
		String completeBehind = "fo";
4132
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4248
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4133
		cu.codeComplete(cursorLocation, requestor);
4249
		cu.codeComplete(cursorLocation, requestor);
4134
4250
4135
		assertEquals(
4251
		assertEquals(
4136
			"",
4252
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4253
			"element:for    completion:for    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4137
			requestor.getResults());
4254
			requestor.getResults());
4138
}
4255
}
4139
public void testCompletionKeywordImplements1() throws JavaModelException {
4256
public void testCompletionKeywordFor2() throws JavaModelException {
4140
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4257
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4141
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements1.java");
4258
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor2.java");
4142
4259
4143
		String str = cu.getSource();
4260
		String str = cu.getSource();
4144
		String completeBehind = "imp";
4261
		String completeBehind = "fo";
4145
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4262
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4146
		cu.codeComplete(cursorLocation, requestor);
4263
		cu.codeComplete(cursorLocation, requestor);
4147
4264
4148
		assertEquals(
4265
		assertEquals(
4149
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4266
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
4150
			requestor.getResults());
4267
			requestor.getResults());
4151
}
4268
}
4152
public void testCompletionKeywordImplements2() throws JavaModelException {
4269
public void testCompletionKeywordFor3() throws JavaModelException {
4153
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4270
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4154
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements2.java");
4271
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor3.java");
4155
4272
4156
		String str = cu.getSource();
4273
		String str = cu.getSource();
4157
		String completeBehind = "imp";
4274
		String completeBehind = "fo";
4158
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4275
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4159
		cu.codeComplete(cursorLocation, requestor);
4276
		cu.codeComplete(cursorLocation, requestor);
4160
4277
4161
		assertEquals(
4278
		assertEquals(
4162
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4279
			"",
4163
			requestor.getResults());
4280
			requestor.getResults());
4164
}
4281
}
4165
public void testCompletionKeywordImplements3() throws JavaModelException {
4282
public void testCompletionKeywordIf1() throws JavaModelException {
4166
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4283
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4167
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements3.java");
4284
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf1.java");
4168
4285
4169
		String str = cu.getSource();
4286
		String str = cu.getSource();
4170
		String completeBehind = "imp";
4287
		String completeBehind = "if";
4171
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4288
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4172
		cu.codeComplete(cursorLocation, requestor);
4289
		cu.codeComplete(cursorLocation, requestor);
4173
4290
4174
		assertEquals(
4291
		assertEquals(
4175
			"",
4292
			"element:if    completion:if    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
4176
			requestor.getResults());
4293
			requestor.getResults());
4177
}
4294
}
4178
public void testCompletionKeywordPackage1() throws JavaModelException {
4295
public void testCompletionKeywordIf2() throws JavaModelException {
4179
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4296
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4180
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage1.java");
4297
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf2.java");
4181
4298
4182
		String str = cu.getSource();
4299
		String str = cu.getSource();
4183
		String completeBehind = "pac";
4300
		String completeBehind = "if";
4184
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4301
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4185
		cu.codeComplete(cursorLocation, requestor);
4302
		cu.codeComplete(cursorLocation, requestor);
4186
4303
4187
		assertEquals(
4304
		assertEquals(
4188
			"element:package    completion:package    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4305
			"",
4189
			requestor.getResults());
4306
			requestor.getResults());
4190
}
4307
}
4191
public void testCompletionKeywordPackage2() throws JavaModelException {
4308
public void testCompletionKeywordIf3() throws JavaModelException {
4192
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4309
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4193
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage2.java");
4310
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf3.java");
4194
4311
4195
		String str = cu.getSource();
4312
		String str = cu.getSource();
4196
		String completeBehind = "pac";
4313
		String completeBehind = "if";
4197
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4314
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4198
		cu.codeComplete(cursorLocation, requestor);
4315
		cu.codeComplete(cursorLocation, requestor);
4199
4316
Lines 4201-4225 Link Here
4201
			"",
4318
			"",
4202
			requestor.getResults());
4319
			requestor.getResults());
4203
}
4320
}
4204
public void testCompletionKeywordPackage3() throws JavaModelException {
4321
public void testCompletionKeywordReturn1() throws JavaModelException {
4205
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4322
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4206
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage3.java");
4323
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn1.java");
4207
4324
4208
		String str = cu.getSource();
4325
		String str = cu.getSource();
4209
		String completeBehind = "pac";
4326
		String completeBehind = "re";
4210
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4327
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4211
		cu.codeComplete(cursorLocation, requestor);
4328
		cu.codeComplete(cursorLocation, requestor);
4212
4329
4213
		assertEquals(
4330
		assertEquals(
4214
			"",
4331
			"element:return    completion:return    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4215
			requestor.getResults());
4332
			requestor.getResults());
4216
}
4333
}
4217
public void testCompletionKeywordPackage4() throws JavaModelException {
4334
public void testCompletionKeywordReturn2() throws JavaModelException {
4218
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4335
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4219
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage4.java");
4336
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn2.java");
4220
4337
4221
		String str = cu.getSource();
4338
		String str = cu.getSource();
4222
		String completeBehind = "pac";
4339
		String completeBehind = "re";
4223
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4340
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4224
		cu.codeComplete(cursorLocation, requestor);
4341
		cu.codeComplete(cursorLocation, requestor);
4225
4342
Lines 4227-4277 Link Here
4227
			"",
4344
			"",
4228
			requestor.getResults());
4345
			requestor.getResults());
4229
}
4346
}
4230
public void testCompletionKeywordImport1() throws JavaModelException {
4347
public void testCompletionKeywordReturn3() throws JavaModelException {
4231
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4348
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4232
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport1.java");
4349
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn3.java");
4233
4350
4234
		String str = cu.getSource();
4351
		String str = cu.getSource();
4235
		String completeBehind = "imp";
4352
		String completeBehind = "re";
4236
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4353
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4237
		cu.codeComplete(cursorLocation, requestor);
4354
		cu.codeComplete(cursorLocation, requestor);
4238
4355
4239
		assertEquals(
4356
		assertEquals(
4240
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4357
			"",
4241
			requestor.getResults());
4358
			requestor.getResults());
4242
}
4359
}
4243
public void testCompletionKeywordImport2() throws JavaModelException {
4360
public void testCompletionKeywordSwitch1() throws JavaModelException {
4244
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4361
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4245
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport2.java");
4362
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch1.java");
4246
4363
4247
		String str = cu.getSource();
4364
		String str = cu.getSource();
4248
		String completeBehind = "imp";
4365
		String completeBehind = "sw";
4249
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4366
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4250
		cu.codeComplete(cursorLocation, requestor);
4367
		cu.codeComplete(cursorLocation, requestor);
4251
4368
4252
		assertEquals(
4369
		assertEquals(
4253
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4370
			"element:switch    completion:switch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4254
			requestor.getResults());
4371
			requestor.getResults());
4255
}
4372
}
4256
public void testCompletionKeywordImport3() throws JavaModelException {
4373
public void testCompletionKeywordSwitch2() throws JavaModelException {
4257
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4374
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4258
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport3.java");
4375
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch2.java");
4259
4376
4260
		String str = cu.getSource();
4377
		String str = cu.getSource();
4261
		String completeBehind = "imp";
4378
		String completeBehind = "sw";
4262
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4379
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4263
		cu.codeComplete(cursorLocation, requestor);
4380
		cu.codeComplete(cursorLocation, requestor);
4264
4381
4265
		assertEquals(
4382
		assertEquals(
4266
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4383
			"",
4267
			requestor.getResults());
4384
			requestor.getResults());
4268
}
4385
}
4269
public void testCompletionKeywordImport4() throws JavaModelException {
4386
public void testCompletionKeywordSwitch3() throws JavaModelException {
4270
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4387
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4271
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport4.java");
4388
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch3.java");
4272
4389
4273
		String str = cu.getSource();
4390
		String str = cu.getSource();
4274
		String completeBehind = "imp";
4391
		String completeBehind = "sw";
4275
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4392
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4276
		cu.codeComplete(cursorLocation, requestor);
4393
		cu.codeComplete(cursorLocation, requestor);
4277
4394
Lines 4279-4342 Link Here
4279
			"",
4396
			"",
4280
			requestor.getResults());
4397
			requestor.getResults());
4281
}
4398
}
4282
public void testCompletionKeywordCase1() throws JavaModelException {
4399
public void testCompletionKeywordThrow1() throws JavaModelException {
4283
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4400
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4284
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase1.java");
4401
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow1.java");
4285
4402
4286
		String str = cu.getSource();
4403
		String str = cu.getSource();
4287
		String completeBehind = "cas";
4404
		String completeBehind = "thr";
4288
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4405
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4289
		cu.codeComplete(cursorLocation, requestor);
4406
		cu.codeComplete(cursorLocation, requestor);
4290
4407
4291
		assertEquals(
4408
		assertEquals(
4292
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4409
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4410
			"element:throw    completion:throw    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4293
			requestor.getResults());
4411
			requestor.getResults());
4294
}
4412
}
4295
public void testCompletionKeywordCase2() throws JavaModelException {
4413
public void testCompletionKeywordThrow2() throws JavaModelException {
4296
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4414
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4297
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase2.java");
4415
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow2.java");
4298
4416
4299
		String str = cu.getSource();
4417
		String str = cu.getSource();
4300
		String completeBehind = "cas";
4418
		String completeBehind = "thr";
4301
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4419
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4302
		cu.codeComplete(cursorLocation, requestor);
4420
		cu.codeComplete(cursorLocation, requestor);
4303
4421
4304
		assertEquals(
4422
		assertEquals(
4305
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4423
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4306
			requestor.getResults());
4424
			requestor.getResults());
4307
}
4425
}
4308
public void testCompletionKeywordCase3() throws JavaModelException {
4426
public void testCompletionKeywordThrow3() throws JavaModelException {
4309
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4427
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4310
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase3.java");
4428
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow3.java");
4311
4429
4312
		String str = cu.getSource();
4430
		String str = cu.getSource();
4313
		String completeBehind = "cas";
4431
		String completeBehind = "thr";
4314
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4432
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4315
		cu.codeComplete(cursorLocation, requestor);
4433
		cu.codeComplete(cursorLocation, requestor);
4316
4434
4317
		assertEquals(
4435
		assertEquals(
4318
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4436
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4319
			requestor.getResults());
4437
			requestor.getResults());
4320
}
4438
}
4321
public void testCompletionKeywordCase4() throws JavaModelException {
4439
public void testCompletionKeywordAssert1() throws JavaModelException {
4322
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4440
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4323
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase4.java");
4441
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert1.java");
4324
4442
4325
		String str = cu.getSource();
4443
		String str = cu.getSource();
4326
		String completeBehind = "cas";
4444
		String completeBehind = "as";
4327
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4445
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4328
		cu.codeComplete(cursorLocation, requestor);
4446
		cu.codeComplete(cursorLocation, requestor);
4329
4447
4330
		assertEquals(
4448
		assertEquals(
4331
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4449
			"element:assert    completion:assert    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4332
			requestor.getResults());
4450
			requestor.getResults());
4333
}
4451
}
4334
public void testCompletionKeywordCase5() throws JavaModelException {
4452
public void testCompletionKeywordAssert2() throws JavaModelException {
4335
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4453
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4336
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase5.java");
4454
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert2.java");
4337
4455
4338
		String str = cu.getSource();
4456
		String str = cu.getSource();
4339
		String completeBehind = "cas";
4457
		String completeBehind = "as";
4340
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4458
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4341
		cu.codeComplete(cursorLocation, requestor);
4459
		cu.codeComplete(cursorLocation, requestor);
4342
4460
Lines 4344-4774 Link Here
4344
			"",
4462
			"",
4345
			requestor.getResults());
4463
			requestor.getResults());
4346
}
4464
}
4347
public void testCompletionKeywordDefault1() throws JavaModelException {
4465
public void testCompletionKeywordAssert3() throws JavaModelException {
4348
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4466
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4349
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault1.java");
4467
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert3.java");
4350
4468
4351
		String str = cu.getSource();
4469
		String str = cu.getSource();
4352
		String completeBehind = "def";
4470
		String completeBehind = "as";
4353
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4471
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4354
		cu.codeComplete(cursorLocation, requestor);
4472
		cu.codeComplete(cursorLocation, requestor);
4355
4473
4356
		assertEquals(
4474
		assertEquals(
4357
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4475
			"",
4358
			requestor.getResults());
4476
			requestor.getResults());
4359
}
4477
}
4360
public void testCompletionKeywordDefault2() throws JavaModelException {
4478
public void testCompletionKeywordElse1() throws JavaModelException {
4361
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4479
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4362
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault2.java");
4480
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse1.java");
4363
4481
4364
		String str = cu.getSource();
4482
		String str = cu.getSource();
4365
		String completeBehind = "def";
4483
		String completeBehind = "els";
4366
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4484
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4367
		cu.codeComplete(cursorLocation, requestor);
4485
		cu.codeComplete(cursorLocation, requestor);
4368
4486
4369
		assertEquals(
4487
		assertEquals(
4370
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4488
			"element:else    completion:else    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4371
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4372
			requestor.getResults());
4489
			requestor.getResults());
4373
}
4490
}
4374
public void testCompletionKeywordDefault3() throws JavaModelException {
4491
public void testCompletionKeywordElse2() throws JavaModelException {
4375
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4492
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4376
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault3.java");
4493
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse2.java");
4377
4494
4378
		String str = cu.getSource();
4495
		String str = cu.getSource();
4379
		String completeBehind = "def";
4496
		String completeBehind = "els";
4380
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4497
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4381
		cu.codeComplete(cursorLocation, requestor);
4498
		cu.codeComplete(cursorLocation, requestor);
4382
4499
4383
		assertEquals(
4500
		assertEquals(
4384
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4501
			"",
4385
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4386
			requestor.getResults());
4502
			requestor.getResults());
4387
}
4503
}
4388
public void testCompletionKeywordDefault4() throws JavaModelException {
4504
public void testCompletionKeywordElse3() throws JavaModelException {
4389
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4505
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4390
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault4.java");
4506
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse3.java");
4391
4507
4392
		String str = cu.getSource();
4508
		String str = cu.getSource();
4393
		String completeBehind = "def";
4509
		String completeBehind = "els";
4394
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4510
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4395
		cu.codeComplete(cursorLocation, requestor);
4511
		cu.codeComplete(cursorLocation, requestor);
4396
4512
4397
		assertEquals(
4513
		assertEquals(
4398
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4514
			"",
4399
			requestor.getResults());
4515
			requestor.getResults());
4400
}
4516
}
4401
public void testCompletionKeywordDefault5() throws JavaModelException {
4517
public void testCompletionKeywordElse4() throws JavaModelException {
4402
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4518
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4403
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault5.java");
4519
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse4.java");
4404
4520
4405
		String str = cu.getSource();
4521
		String str = cu.getSource();
4406
		String completeBehind = "def";
4522
		String completeBehind = "els";
4407
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4523
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4408
		cu.codeComplete(cursorLocation, requestor);
4524
		cu.codeComplete(cursorLocation, requestor);
4409
4525
4410
		assertEquals(
4526
		assertEquals(
4411
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
4527
			"",
4412
			requestor.getResults());
4528
			requestor.getResults());
4413
}
4529
}
4414
public void testCompletionKeywordClass1() throws JavaModelException {
4530
public void testCompletionKeywordCatch1() throws JavaModelException {
4415
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4531
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4416
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass1.java");
4532
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch1.java");
4417
4533
4418
		String str = cu.getSource();
4534
		String str = cu.getSource();
4419
		String completeBehind = "cla";
4535
		String completeBehind = "cat";
4420
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4536
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4421
		cu.codeComplete(cursorLocation, requestor);
4537
		cu.codeComplete(cursorLocation, requestor);
4422
4538
4423
		assertEquals(
4539
		assertEquals(
4424
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4540
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4425
			requestor.getResults());
4541
			requestor.getResults());
4426
}
4542
}
4427
public void testCompletionKeywordClass2() throws JavaModelException {
4543
public void testCompletionKeywordCatch2() throws JavaModelException {
4428
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4544
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4429
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass2.java");
4545
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch2.java");
4430
4546
4431
		String str = cu.getSource();
4547
		String str = cu.getSource();
4432
		String completeBehind = "cla";
4548
		String completeBehind = "cat";
4433
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4549
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4434
		cu.codeComplete(cursorLocation, requestor);
4550
		cu.codeComplete(cursorLocation, requestor);
4435
4551
4436
		assertEquals(
4552
		assertEquals(
4437
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4553
			"",
4438
			requestor.getResults());
4554
			requestor.getResults());
4439
}
4555
}
4440
public void testCompletionKeywordClass3() throws JavaModelException {
4556
public void testCompletionKeywordCatch3() throws JavaModelException {
4441
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4557
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4442
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass3.java");
4558
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch3.java");
4443
4559
4444
		String str = cu.getSource();
4560
		String str = cu.getSource();
4445
		String completeBehind = "cla";
4561
		String completeBehind = "cat";
4446
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4562
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4447
		cu.codeComplete(cursorLocation, requestor);
4563
		cu.codeComplete(cursorLocation, requestor);
4448
4564
4449
		assertEquals(
4565
		assertEquals(
4450
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4566
			"",
4451
			requestor.getResults());
4567
			requestor.getResults());
4452
}
4568
}
4453
public void testCompletionKeywordClass4() throws JavaModelException {
4569
public void testCompletionKeywordCatch4() throws JavaModelException {
4454
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4570
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4455
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass4.java");
4571
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch4.java");
4456
4572
4457
		String str = cu.getSource();
4573
		String str = cu.getSource();
4458
		String completeBehind = "cla";
4574
		String completeBehind = "cat";
4459
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4575
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4460
		cu.codeComplete(cursorLocation, requestor);
4576
		cu.codeComplete(cursorLocation, requestor);
4461
4577
4462
		assertEquals(
4578
		assertEquals(
4463
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4579
			"",
4464
			requestor.getResults());
4580
			requestor.getResults());
4465
}
4581
}
4466
public void testCompletionKeywordClass5() throws JavaModelException {
4582
public void testCompletionKeywordCatch5() throws JavaModelException {
4467
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4583
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4468
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass5.java");
4584
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch5.java");
4469
4585
4470
		String str = cu.getSource();
4586
		String str = cu.getSource();
4471
		String completeBehind = "cla";
4587
		String completeBehind = "cat";
4472
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4588
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4473
		cu.codeComplete(cursorLocation, requestor);
4589
		cu.codeComplete(cursorLocation, requestor);
4474
4590
4475
		assertEquals(
4591
		assertEquals(
4476
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4592
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
4593
			"element:catchz    completion:catchz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
4477
			requestor.getResults());
4594
			requestor.getResults());
4478
}
4595
}
4479
public void testCompletionKeywordClass6() throws JavaModelException {
4596
public void testCompletionKeywordFinally1() throws JavaModelException {
4480
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4597
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4481
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass6.java");
4598
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally1.java");
4482
4599
4483
		String str = cu.getSource();
4600
		String str = cu.getSource();
4484
		String completeBehind = "cla";
4601
		String completeBehind = "finall";
4485
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4602
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4486
		cu.codeComplete(cursorLocation, requestor);
4603
		cu.codeComplete(cursorLocation, requestor);
4487
4604
4488
		assertEquals(
4605
		assertEquals(
4489
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4606
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4490
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4491
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4492
			requestor.getResults());
4607
			requestor.getResults());
4493
}
4608
}
4494
public void testCompletionKeywordClass7() throws JavaModelException {
4609
public void testCompletionKeywordFinally2() throws JavaModelException {
4495
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4610
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4496
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass7.java");
4611
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally2.java");
4497
4612
4498
		String str = cu.getSource();
4613
		String str = cu.getSource();
4499
		String completeBehind = "cla";
4614
		String completeBehind = "finall";
4500
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4615
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4501
		cu.codeComplete(cursorLocation, requestor);
4616
		cu.codeComplete(cursorLocation, requestor);
4502
4617
4503
		assertEquals(
4618
		assertEquals(
4504
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4619
			"",
4505
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4506
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4507
			requestor.getResults());
4620
			requestor.getResults());
4508
}
4621
}
4509
public void testCompletionKeywordClass8() throws JavaModelException {
4622
public void testCompletionKeywordFinally3() throws JavaModelException {
4510
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4623
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4511
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass8.java");
4624
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally3.java");
4512
4625
4513
		String str = cu.getSource();
4626
		String str = cu.getSource();
4514
		String completeBehind = "cla";
4627
		String completeBehind = "finall";
4515
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4628
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4516
		cu.codeComplete(cursorLocation, requestor);
4629
		cu.codeComplete(cursorLocation, requestor);
4517
4630
4518
		assertEquals(
4631
		assertEquals(
4519
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4632
			"",
4520
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4521
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4522
			requestor.getResults());
4633
			requestor.getResults());
4523
}
4634
}
4524
public void testCompletionKeywordClass9() throws JavaModelException {
4635
public void testCompletionKeywordFinally4() throws JavaModelException {
4525
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4636
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4526
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass9.java");
4637
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally4.java");
4527
4638
4528
		String str = cu.getSource();
4639
		String str = cu.getSource();
4529
		String completeBehind = "cla";
4640
		String completeBehind = "finall";
4530
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4641
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4531
		cu.codeComplete(cursorLocation, requestor);
4642
		cu.codeComplete(cursorLocation, requestor);
4532
4643
4533
		assertEquals(
4644
		assertEquals(
4534
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4645
			"",
4535
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4536
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4537
			requestor.getResults());
4646
			requestor.getResults());
4538
}
4647
}
4539
public void testCompletionKeywordClass10() throws JavaModelException {
4648
public void testCompletionKeywordFinally5() throws JavaModelException {
4540
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4649
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4541
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass10.java");
4650
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally5.java");
4542
4651
4543
		String str = cu.getSource();
4652
		String str = cu.getSource();
4544
		String completeBehind = "cla";
4653
		String completeBehind = "finall";
4545
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4654
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4546
		cu.codeComplete(cursorLocation, requestor);
4655
		cu.codeComplete(cursorLocation, requestor);
4547
4656
4548
		assertEquals(
4657
		assertEquals(
4549
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4658
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4550
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4551
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4552
			requestor.getResults());
4659
			requestor.getResults());
4553
}
4660
}
4554
public void testCompletionKeywordClass11() throws JavaModelException {
4661
public void testCompletionKeywordFinally6() throws JavaModelException {
4555
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4662
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4556
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass11.java");
4663
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally6.java");
4557
4664
4558
		String str = cu.getSource();
4665
		String str = cu.getSource();
4559
		String completeBehind = "cla";
4666
		String completeBehind = "finall";
4560
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4667
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4561
		cu.codeComplete(cursorLocation, requestor);
4668
		cu.codeComplete(cursorLocation, requestor);
4562
4669
4563
		assertEquals(
4670
		assertEquals(
4564
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4671
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
4565
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4672
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
4566
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4567
			requestor.getResults());
4673
			requestor.getResults());
4568
}
4674
}
4569
public void testCompletionKeywordClass12() throws JavaModelException {
4675
public void testCompletionKeywordFinally7() throws JavaModelException {
4570
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4676
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4571
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass12.java");
4677
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally7.java");
4572
4678
4573
		String str = cu.getSource();
4679
		String str = cu.getSource();
4574
		String completeBehind = "cla";
4680
		String completeBehind = "finall";
4575
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4681
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4576
		cu.codeComplete(cursorLocation, requestor);
4682
		cu.codeComplete(cursorLocation, requestor);
4577
4683
4578
		assertEquals(
4684
		assertEquals(
4579
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4685
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
4580
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
4581
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4582
			requestor.getResults());
4686
			requestor.getResults());
4583
}
4687
}
4584
public void testCompletionKeywordInterface1() throws JavaModelException {
4688
public void testCompletionKeywordContinue1() throws JavaModelException {
4585
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4689
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4586
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
4690
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue1.java");
4587
4691
4588
		String str = cu.getSource();
4692
		String str = cu.getSource();
4589
		String completeBehind = "interf";
4693
		String completeBehind = "cont";
4590
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4694
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4591
		cu.codeComplete(cursorLocation, requestor);
4695
		cu.codeComplete(cursorLocation, requestor);
4592
4696
4593
		assertEquals(
4697
		assertEquals(
4594
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4698
			"element:continue    completion:continue    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4595
			requestor.getResults());
4699
			requestor.getResults());
4596
}
4700
}
4597
public void testCompletionKeywordInterface2() throws JavaModelException {
4701
public void testCompletionKeywordContinue2() throws JavaModelException {
4598
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4702
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4599
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface2.java");
4703
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue2.java");
4600
4704
4601
		String str = cu.getSource();
4705
		String str = cu.getSource();
4602
		String completeBehind = "interf";
4706
		String completeBehind = "cont";
4603
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4707
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4604
		cu.codeComplete(cursorLocation, requestor);
4708
		cu.codeComplete(cursorLocation, requestor);
4605
4709
4606
		assertEquals(
4710
		assertEquals(
4607
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4711
			"",
4608
			requestor.getResults());
4712
			requestor.getResults());
4609
}
4713
}
4610
public void testCompletionKeywordInterface3() throws JavaModelException {
4714
public void testCompletionKeywordBreak1() throws JavaModelException {
4611
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4715
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4612
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface3.java");
4716
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak1.java");
4613
4717
4614
		String str = cu.getSource();
4718
		String str = cu.getSource();
4615
		String completeBehind = "interf";
4719
		String completeBehind = "bre";
4616
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4720
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4617
		cu.codeComplete(cursorLocation, requestor);
4721
		cu.codeComplete(cursorLocation, requestor);
4618
4722
4619
		assertEquals(
4723
		assertEquals(
4620
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4724
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4621
			requestor.getResults());
4725
			requestor.getResults());
4622
}
4726
}
4623
public void testCompletionKeywordInterface4() throws JavaModelException {
4727
public void testCompletionKeywordBreak2() throws JavaModelException {
4624
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4728
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4625
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface4.java");
4729
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak2.java");
4626
4730
4627
		String str = cu.getSource();
4731
		String str = cu.getSource();
4628
		String completeBehind = "interf";
4732
		String completeBehind = "bre";
4629
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4733
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4630
		cu.codeComplete(cursorLocation, requestor);
4734
		cu.codeComplete(cursorLocation, requestor);
4631
4735
4632
		assertEquals(
4736
		assertEquals(
4633
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4737
			"",
4634
			requestor.getResults());
4738
			requestor.getResults());
4635
}
4739
}
4636
public void testCompletionKeywordInterface5() throws JavaModelException {
4740
public void testCompletionKeywordBreak3() throws JavaModelException {
4637
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4741
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4638
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface5.java");
4742
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak3.java");
4639
4743
4640
		String str = cu.getSource();
4744
		String str = cu.getSource();
4641
		String completeBehind = "interf";
4745
		String completeBehind = "bre";
4642
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4746
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4643
		cu.codeComplete(cursorLocation, requestor);
4747
		cu.codeComplete(cursorLocation, requestor);
4644
4748
4645
		assertEquals(
4749
		assertEquals(
4646
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4750
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4647
			requestor.getResults());
4751
			requestor.getResults());
4648
}
4752
}
4649
public void testCompletionKeywordInterface6() throws JavaModelException {
4753
public void testCompletionKeywordWhile1() throws JavaModelException {
4650
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4754
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4651
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface6.java");
4755
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile1.java");
4652
4756
4653
		String str = cu.getSource();
4757
		String str = cu.getSource();
4654
		String completeBehind = "interf";
4758
		String completeBehind = "wh";
4655
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4759
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4656
		cu.codeComplete(cursorLocation, requestor);
4760
		cu.codeComplete(cursorLocation, requestor);
4657
4761
4658
		assertEquals(
4762
		assertEquals(
4659
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4763
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4660
			requestor.getResults());
4764
			requestor.getResults());
4661
}
4765
}
4662
public void testCompletionKeywordInterface7() throws JavaModelException {
4766
public void testCompletionKeywordWhile2() throws JavaModelException {
4663
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4767
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4664
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface7.java");
4768
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile2.java");
4665
4769
4666
		String str = cu.getSource();
4770
		String str = cu.getSource();
4667
		String completeBehind = "interf";
4771
		String completeBehind = "wh";
4668
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4772
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4669
		cu.codeComplete(cursorLocation, requestor);
4773
		cu.codeComplete(cursorLocation, requestor);
4670
4774
4671
		assertEquals(
4775
		assertEquals(
4672
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4776
			"",
4673
			requestor.getResults());
4777
			requestor.getResults());
4674
}
4778
}
4675
public void testCompletionKeywordInterface8() throws JavaModelException {
4779
public void testCompletionKeywordWhile3() throws JavaModelException {
4676
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4780
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4677
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface8.java");
4781
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile3.java");
4678
4782
4679
		String str = cu.getSource();
4783
		String str = cu.getSource();
4680
		String completeBehind = "interf";
4784
		String completeBehind = "wh";
4681
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4785
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4682
		cu.codeComplete(cursorLocation, requestor);
4786
		cu.codeComplete(cursorLocation, requestor);
4683
4787
4684
		assertEquals(
4788
		assertEquals(
4685
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4789
			"",
4686
			requestor.getResults());
4790
			requestor.getResults());
4687
}
4791
}
4688
public void testCompletionKeywordInterface9() throws JavaModelException {
4792
public void testCompletionKeywordWhile4() throws JavaModelException {
4689
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4793
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4690
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface9.java");
4794
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile4.java");
4691
4795
4692
		String str = cu.getSource();
4796
		String str = cu.getSource();
4693
		String completeBehind = "interf";
4797
		String completeBehind = "wh";
4694
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4798
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4695
		cu.codeComplete(cursorLocation, requestor);
4799
		cu.codeComplete(cursorLocation, requestor);
4696
4800
4697
		assertEquals(
4801
		assertEquals(
4698
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4802
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4699
			requestor.getResults());
4803
			requestor.getResults());
4700
}
4804
}
4701
public void testCompletionKeywordThrows1() throws JavaModelException {
4805
public void testCompletionKeywordWhile5() throws JavaModelException {
4702
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4806
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4703
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows1.java");
4807
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile5.java");
4704
4808
4705
		String str = cu.getSource();
4809
		String str = cu.getSource();
4706
		String completeBehind = "thro";
4810
		String completeBehind = "wh";
4707
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4811
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4708
		cu.codeComplete(cursorLocation, requestor);
4812
		cu.codeComplete(cursorLocation, requestor);
4709
4813
4710
		assertEquals(
4814
		assertEquals(
4711
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4815
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4712
			requestor.getResults());
4816
			requestor.getResults());
4713
}
4817
}
4714
public void testCompletionKeywordThrows2() throws JavaModelException {
4818
public void testCompletionKeywordExtends1() throws JavaModelException {
4715
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4819
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4716
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows2.java");
4820
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends1.java");
4717
4821
4718
		String str = cu.getSource();
4822
		String str = cu.getSource();
4719
		String completeBehind = "thro";
4823
		String completeBehind = "ext";
4720
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4824
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4721
		cu.codeComplete(cursorLocation, requestor);
4825
		cu.codeComplete(cursorLocation, requestor);
4722
4826
4723
		assertEquals(
4827
		assertEquals(
4724
			"",
4828
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4725
			requestor.getResults());
4829
			requestor.getResults());
4726
}
4830
}
4727
public void testCompletionKeywordThrows3() throws JavaModelException {
4831
public void testCompletionKeywordExtends2() throws JavaModelException {
4728
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4832
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4729
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows3.java");
4833
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends2.java");
4730
4834
4731
		String str = cu.getSource();
4835
		String str = cu.getSource();
4732
		String completeBehind = "thro";
4836
		String completeBehind = "ext";
4733
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4837
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4734
		cu.codeComplete(cursorLocation, requestor);
4838
		cu.codeComplete(cursorLocation, requestor);
4735
4839
4736
		assertEquals(
4840
		assertEquals(
4737
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4841
			"",
4738
			requestor.getResults());
4842
			requestor.getResults());
4739
}
4843
}
4740
public void testCompletionKeywordThrows4() throws JavaModelException {
4844
public void testCompletionKeywordExtends3() throws JavaModelException {
4741
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4845
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4742
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows4.java");
4846
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends3.java");
4743
4847
4744
		String str = cu.getSource();
4848
		String str = cu.getSource();
4745
		String completeBehind = "thro";
4849
		String completeBehind = "ext";
4746
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4850
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4747
		cu.codeComplete(cursorLocation, requestor);
4851
		cu.codeComplete(cursorLocation, requestor);
4748
4852
4749
		assertEquals(
4853
		assertEquals(
4750
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4854
			"",
4751
			requestor.getResults());
4855
			requestor.getResults());
4752
}
4856
}
4753
public void testCompletionKeywordSynchronized1() throws JavaModelException {
4857
public void testCompletionKeywordExtends4() throws JavaModelException {
4754
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4858
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4755
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized1.java");
4859
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends4.java");
4756
4860
4757
		String str = cu.getSource();
4861
		String str = cu.getSource();
4758
		String completeBehind = "syn";
4862
		String completeBehind = "ext";
4759
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4863
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4760
		cu.codeComplete(cursorLocation, requestor);
4864
		cu.codeComplete(cursorLocation, requestor);
4761
4865
4762
		assertEquals(
4866
		assertEquals(
4763
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4867
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4764
			requestor.getResults());
4868
			requestor.getResults());
4765
}
4869
}
4766
public void testCompletionKeywordSynchronized2() throws JavaModelException {
4870
public void testCompletionKeywordExtends5() throws JavaModelException {
4767
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4871
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4768
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized2.java");
4872
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends5.java");
4769
4873
4770
		String str = cu.getSource();
4874
		String str = cu.getSource();
4771
		String completeBehind = "syn";
4875
		String completeBehind = "ext";
4772
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4876
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4773
		cu.codeComplete(cursorLocation, requestor);
4877
		cu.codeComplete(cursorLocation, requestor);
4774
4878
Lines 4776-4852 Link Here
4776
			"",
4880
			"",
4777
			requestor.getResults());
4881
			requestor.getResults());
4778
}
4882
}
4779
public void testCompletionKeywordSynchronized3() throws JavaModelException {
4883
public void testCompletionKeywordImplements1() throws JavaModelException {
4780
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4884
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4781
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized3.java");
4885
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements1.java");
4782
4886
4783
		String str = cu.getSource();
4887
		String str = cu.getSource();
4784
		String completeBehind = "syn";
4888
		String completeBehind = "imp";
4785
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4889
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4786
		cu.codeComplete(cursorLocation, requestor);
4890
		cu.codeComplete(cursorLocation, requestor);
4787
4891
4788
		assertEquals(
4892
		assertEquals(
4789
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4893
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4790
			requestor.getResults());
4894
			requestor.getResults());
4791
}
4895
}
4792
public void testCompletionKeywordSynchronized4() throws JavaModelException {
4896
public void testCompletionKeywordImplements2() throws JavaModelException {
4793
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4897
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4794
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized4.java");
4898
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements2.java");
4795
4899
4796
		String str = cu.getSource();
4900
		String str = cu.getSource();
4797
		String completeBehind = "syn";
4901
		String completeBehind = "imp";
4798
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4902
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4799
		cu.codeComplete(cursorLocation, requestor);
4903
		cu.codeComplete(cursorLocation, requestor);
4800
4904
4801
		assertEquals(
4905
		assertEquals(
4802
			"",
4906
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4803
			requestor.getResults());
4907
			requestor.getResults());
4804
}
4908
}
4805
public void testCompletionKeywordSynchronized5() throws JavaModelException {
4909
public void testCompletionKeywordImplements3() throws JavaModelException {
4806
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4910
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4807
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized5.java");
4911
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements3.java");
4808
4912
4809
		String str = cu.getSource();
4913
		String str = cu.getSource();
4810
		String completeBehind = "syn";
4914
		String completeBehind = "imp";
4811
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4915
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4812
		cu.codeComplete(cursorLocation, requestor);
4916
		cu.codeComplete(cursorLocation, requestor);
4813
4917
4814
		assertEquals(
4918
		assertEquals(
4815
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4919
			"",
4816
			requestor.getResults());
4920
			requestor.getResults());
4817
}
4921
}
4818
public void testCompletionKeywordSynchronized6() throws JavaModelException {
4922
public void testCompletionKeywordPackage1() throws JavaModelException {
4819
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4923
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4820
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized6.java");
4924
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage1.java");
4821
4925
4822
		String str = cu.getSource();
4926
		String str = cu.getSource();
4823
		String completeBehind = "syn";
4927
		String completeBehind = "pac";
4824
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4928
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4825
		cu.codeComplete(cursorLocation, requestor);
4929
		cu.codeComplete(cursorLocation, requestor);
4826
4930
4827
		assertEquals(
4931
		assertEquals(
4828
			"",
4932
			"element:package    completion:package    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4829
			requestor.getResults());
4933
			requestor.getResults());
4830
}
4934
}
4831
public void testCompletionKeywordNative1() throws JavaModelException {
4935
public void testCompletionKeywordPackage2() throws JavaModelException {
4832
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4936
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4833
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative1.java");
4937
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage2.java");
4834
4938
4835
		String str = cu.getSource();
4939
		String str = cu.getSource();
4836
		String completeBehind = "nat";
4940
		String completeBehind = "pac";
4837
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4941
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4838
		cu.codeComplete(cursorLocation, requestor);
4942
		cu.codeComplete(cursorLocation, requestor);
4839
4943
4840
		assertEquals(
4944
		assertEquals(
4841
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4945
			"",
4842
			requestor.getResults());
4946
			requestor.getResults());
4843
}
4947
}
4844
public void testCompletionKeywordNative2() throws JavaModelException {
4948
public void testCompletionKeywordPackage3() throws JavaModelException {
4845
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4949
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4846
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative2.java");
4950
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage3.java");
4847
4951
4848
		String str = cu.getSource();
4952
		String str = cu.getSource();
4849
		String completeBehind = "nat";
4953
		String completeBehind = "pac";
4850
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4954
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4851
		cu.codeComplete(cursorLocation, requestor);
4955
		cu.codeComplete(cursorLocation, requestor);
4852
4956
Lines 4854-4982 Link Here
4854
			"",
4958
			"",
4855
			requestor.getResults());
4959
			requestor.getResults());
4856
}
4960
}
4857
public void testCompletionKeywordNative3() throws JavaModelException {
4961
public void testCompletionKeywordPackage4() throws JavaModelException {
4858
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4962
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4859
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative3.java");
4963
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage4.java");
4860
4964
4861
		String str = cu.getSource();
4965
		String str = cu.getSource();
4862
		String completeBehind = "nat";
4966
		String completeBehind = "pac";
4863
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4967
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4864
		cu.codeComplete(cursorLocation, requestor);
4968
		cu.codeComplete(cursorLocation, requestor);
4865
4969
4866
		assertEquals(
4970
		assertEquals(
4867
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4971
			"",
4868
			requestor.getResults());
4972
			requestor.getResults());
4869
}
4973
}
4870
public void testCompletionKeywordNative4() throws JavaModelException {
4974
public void testCompletionKeywordImport1() throws JavaModelException {
4871
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4975
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4872
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative4.java");
4976
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport1.java");
4873
4977
4874
		String str = cu.getSource();
4978
		String str = cu.getSource();
4875
		String completeBehind = "nat";
4979
		String completeBehind = "imp";
4876
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4980
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4877
		cu.codeComplete(cursorLocation, requestor);
4981
		cu.codeComplete(cursorLocation, requestor);
4878
4982
4879
		assertEquals(
4983
		assertEquals(
4880
			"",
4984
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4881
			requestor.getResults());
4985
			requestor.getResults());
4882
}
4986
}
4883
public void testCompletionKeywordStrictfp1() throws JavaModelException {
4987
public void testCompletionKeywordImport2() throws JavaModelException {
4884
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4988
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4885
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp1.java");
4989
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport2.java");
4886
4990
4887
		String str = cu.getSource();
4991
		String str = cu.getSource();
4888
		String completeBehind = "stric";
4992
		String completeBehind = "imp";
4889
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4993
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4890
		cu.codeComplete(cursorLocation, requestor);
4994
		cu.codeComplete(cursorLocation, requestor);
4891
4995
4892
		assertEquals(
4996
		assertEquals(
4893
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4997
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4894
			requestor.getResults());
4998
			requestor.getResults());
4895
}
4999
}
4896
public void testCompletionKeywordStrictfp2() throws JavaModelException {
5000
public void testCompletionKeywordImport3() throws JavaModelException {
4897
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5001
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4898
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp2.java");
5002
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport3.java");
4899
5003
4900
		String str = cu.getSource();
5004
		String str = cu.getSource();
4901
		String completeBehind = "stric";
5005
		String completeBehind = "imp";
4902
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5006
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4903
		cu.codeComplete(cursorLocation, requestor);
5007
		cu.codeComplete(cursorLocation, requestor);
4904
5008
4905
		assertEquals(
5009
		assertEquals(
4906
			"",
5010
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4907
			requestor.getResults());
5011
			requestor.getResults());
4908
}
5012
}
4909
public void testCompletionKeywordStrictfp3() throws JavaModelException {
5013
public void testCompletionKeywordImport4() throws JavaModelException {
4910
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5014
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4911
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp3.java");
5015
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport4.java");
4912
5016
4913
		String str = cu.getSource();
5017
		String str = cu.getSource();
4914
		String completeBehind = "stric";
5018
		String completeBehind = "imp";
4915
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5019
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4916
		cu.codeComplete(cursorLocation, requestor);
5020
		cu.codeComplete(cursorLocation, requestor);
4917
5021
4918
		assertEquals(
5022
		assertEquals(
4919
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5023
			"",
4920
			requestor.getResults());
5024
			requestor.getResults());
4921
}
5025
}
4922
public void testCompletionKeywordStrictfp4() throws JavaModelException {
5026
public void testCompletionKeywordCase1() throws JavaModelException {
4923
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5027
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4924
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp4.java");
5028
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase1.java");
4925
5029
4926
		String str = cu.getSource();
5030
		String str = cu.getSource();
4927
		String completeBehind = "stric";
5031
		String completeBehind = "cas";
4928
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5032
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4929
		cu.codeComplete(cursorLocation, requestor);
5033
		cu.codeComplete(cursorLocation, requestor);
4930
5034
4931
		assertEquals(
5035
		assertEquals(
4932
			"",
5036
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4933
			requestor.getResults());
5037
			requestor.getResults());
4934
}
5038
}
4935
public void testCompletionKeywordVolatile1() throws JavaModelException {
5039
public void testCompletionKeywordCase2() throws JavaModelException {
4936
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5040
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4937
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile1.java");
5041
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase2.java");
4938
5042
4939
		String str = cu.getSource();
5043
		String str = cu.getSource();
4940
		String completeBehind = "vol";
5044
		String completeBehind = "cas";
4941
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5045
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4942
		cu.codeComplete(cursorLocation, requestor);
5046
		cu.codeComplete(cursorLocation, requestor);
4943
5047
4944
		assertEquals(
5048
		assertEquals(
4945
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5049
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4946
			requestor.getResults());
5050
			requestor.getResults());
4947
}
5051
}
4948
public void testCompletionKeywordVolatile2() throws JavaModelException {
5052
public void testCompletionKeywordCase3() throws JavaModelException {
4949
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5053
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4950
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile2.java");
5054
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase3.java");
4951
5055
4952
		String str = cu.getSource();
5056
		String str = cu.getSource();
4953
		String completeBehind = "vol";
5057
		String completeBehind = "cas";
4954
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5058
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4955
		cu.codeComplete(cursorLocation, requestor);
5059
		cu.codeComplete(cursorLocation, requestor);
4956
5060
4957
		assertEquals(
5061
		assertEquals(
4958
			"",
5062
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4959
			requestor.getResults());
5063
			requestor.getResults());
4960
}
5064
}
4961
public void testCompletionKeywordVolatile3() throws JavaModelException {
5065
public void testCompletionKeywordCase4() throws JavaModelException {
4962
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5066
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4963
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile3.java");
5067
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase4.java");
4964
5068
4965
		String str = cu.getSource();
5069
		String str = cu.getSource();
4966
		String completeBehind = "vol";
5070
		String completeBehind = "cas";
4967
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5071
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4968
		cu.codeComplete(cursorLocation, requestor);
5072
		cu.codeComplete(cursorLocation, requestor);
4969
5073
4970
		assertEquals(
5074
		assertEquals(
4971
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5075
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4972
			requestor.getResults());
5076
			requestor.getResults());
4973
}
5077
}
4974
public void testCompletionKeywordVolatile4() throws JavaModelException {
5078
public void testCompletionKeywordCase5() throws JavaModelException {
4975
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5079
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4976
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile4.java");
5080
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase5.java");
4977
5081
4978
		String str = cu.getSource();
5082
		String str = cu.getSource();
4979
		String completeBehind = "vol";
5083
		String completeBehind = "cas";
4980
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5084
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4981
		cu.codeComplete(cursorLocation, requestor);
5085
		cu.codeComplete(cursorLocation, requestor);
4982
5086
Lines 4984-5398 Link Here
4984
			"",
5088
			"",
4985
			requestor.getResults());
5089
			requestor.getResults());
4986
}
5090
}
4987
public void testCompletionKeywordTransient1() throws JavaModelException {
5091
public void testCompletionKeywordDefault1() throws JavaModelException {
4988
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5092
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
4989
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient1.java");
5093
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault1.java");
4990
5094
4991
		String str = cu.getSource();
5095
		String str = cu.getSource();
4992
		String completeBehind = "tran";
5096
		String completeBehind = "def";
4993
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5097
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
4994
		cu.codeComplete(cursorLocation, requestor);
5098
		cu.codeComplete(cursorLocation, requestor);
4995
5099
4996
		assertEquals(
5100
		assertEquals(
4997
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5101
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
4998
			requestor.getResults());
5102
			requestor.getResults());
4999
}
5103
}
5000
public void testCompletionKeywordTransient2() throws JavaModelException {
5104
public void testCompletionKeywordDefault2() throws JavaModelException {
5001
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5105
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5002
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient2.java");
5106
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault2.java");
5003
5107
5004
		String str = cu.getSource();
5108
		String str = cu.getSource();
5005
		String completeBehind = "tran";
5109
		String completeBehind = "def";
5006
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5110
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5007
		cu.codeComplete(cursorLocation, requestor);
5111
		cu.codeComplete(cursorLocation, requestor);
5008
5112
5009
		assertEquals(
5113
		assertEquals(
5010
			"",
5114
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5115
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5011
			requestor.getResults());
5116
			requestor.getResults());
5012
}
5117
}
5013
public void testCompletionKeywordTransient3() throws JavaModelException {
5118
public void testCompletionKeywordDefault3() throws JavaModelException {
5014
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5119
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5015
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient3.java");
5120
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault3.java");
5016
5121
5017
		String str = cu.getSource();
5122
		String str = cu.getSource();
5018
		String completeBehind = "tran";
5123
		String completeBehind = "def";
5019
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5124
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5020
		cu.codeComplete(cursorLocation, requestor);
5125
		cu.codeComplete(cursorLocation, requestor);
5021
5126
5022
		assertEquals(
5127
		assertEquals(
5023
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5128
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5129
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5024
			requestor.getResults());
5130
			requestor.getResults());
5025
}
5131
}
5026
public void testCompletionKeywordTransient4() throws JavaModelException {
5132
public void testCompletionKeywordDefault4() throws JavaModelException {
5027
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5133
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5028
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient4.java");
5134
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault4.java");
5029
5135
5030
		String str = cu.getSource();
5136
		String str = cu.getSource();
5031
		String completeBehind = "tran";
5137
		String completeBehind = "def";
5032
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5138
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5033
		cu.codeComplete(cursorLocation, requestor);
5139
		cu.codeComplete(cursorLocation, requestor);
5034
5140
5035
		assertEquals(
5141
		assertEquals(
5036
			"",
5142
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
5037
			requestor.getResults());
5143
			requestor.getResults());
5038
}
5144
}
5039
public void testCompletionKeywordNew1() throws JavaModelException {
5145
public void testCompletionKeywordDefault5() throws JavaModelException {
5040
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5146
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5041
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew1.java");
5147
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault5.java");
5042
5148
5043
		String str = cu.getSource();
5149
		String str = cu.getSource();
5044
		String completeBehind = "ne";
5150
		String completeBehind = "def";
5045
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5151
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5046
		cu.codeComplete(cursorLocation, requestor);
5152
		cu.codeComplete(cursorLocation, requestor);
5047
5153
5048
		assertEquals(
5154
		assertEquals(
5049
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5155
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
5050
			requestor.getResults());
5156
			requestor.getResults());
5051
}
5157
}
5052
public void testCompletionKeywordNew2() throws JavaModelException {
5158
public void testCompletionKeywordClass1() throws JavaModelException {
5053
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5159
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5054
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew2.java");
5160
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass1.java");
5055
5161
5056
		String str = cu.getSource();
5162
		String str = cu.getSource();
5057
		String completeBehind = "ne";
5163
		String completeBehind = "cla";
5058
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5164
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5059
		cu.codeComplete(cursorLocation, requestor);
5165
		cu.codeComplete(cursorLocation, requestor);
5060
5166
5061
		assertEquals(
5167
		assertEquals(
5062
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5168
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5063
			requestor.getResults());
5169
			requestor.getResults());
5064
}
5170
}
5065
public void testCompletionKeywordNew3() throws JavaModelException {
5171
public void testCompletionKeywordClass2() throws JavaModelException {
5066
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5172
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5067
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew3.java");
5173
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass2.java");
5068
5174
5069
		String str = cu.getSource();
5175
		String str = cu.getSource();
5070
		String completeBehind = "ne";
5176
		String completeBehind = "cla";
5071
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5177
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5072
		cu.codeComplete(cursorLocation, requestor);
5178
		cu.codeComplete(cursorLocation, requestor);
5073
5179
5074
		assertEquals(
5180
		assertEquals(
5075
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5181
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5076
			requestor.getResults());
5182
			requestor.getResults());
5077
}
5183
}
5078
public void testCompletionKeywordNew4() throws JavaModelException {
5184
public void testCompletionKeywordClass3() throws JavaModelException {
5079
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5185
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5080
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew4.java");
5186
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass3.java");
5081
5187
5082
		String str = cu.getSource();
5188
		String str = cu.getSource();
5083
		String completeBehind = "ne";
5189
		String completeBehind = "cla";
5084
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5190
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5085
		cu.codeComplete(cursorLocation, requestor);
5191
		cu.codeComplete(cursorLocation, requestor);
5086
5192
5087
		assertEquals(
5193
		assertEquals(
5088
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5194
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5089
			requestor.getResults());
5195
			requestor.getResults());
5090
}
5196
}
5091
public void testCompletionKeywordNew5() throws JavaModelException {
5197
public void testCompletionKeywordClass4() throws JavaModelException {
5092
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5198
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5093
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew5.java");
5199
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass4.java");
5094
5200
5095
		String str = cu.getSource();
5201
		String str = cu.getSource();
5096
		String completeBehind = "ne";
5202
		String completeBehind = "cla";
5097
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5203
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5098
		cu.codeComplete(cursorLocation, requestor);
5204
		cu.codeComplete(cursorLocation, requestor);
5099
5205
5100
		assertEquals(
5206
		assertEquals(
5101
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5207
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5102
			requestor.getResults());
5208
			requestor.getResults());
5103
}
5209
}
5104
public void testCompletionKeywordNew6() throws JavaModelException {
5210
public void testCompletionKeywordClass5() throws JavaModelException {
5105
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5211
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5106
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew6.java");
5212
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass5.java");
5107
5213
5108
		String str = cu.getSource();
5214
		String str = cu.getSource();
5109
		String completeBehind = "ne";
5215
		String completeBehind = "cla";
5110
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5216
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5111
		cu.codeComplete(cursorLocation, requestor);
5217
		cu.codeComplete(cursorLocation, requestor);
5112
5218
5113
		assertEquals(
5219
		assertEquals(
5114
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5220
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5115
			requestor.getResults());
5221
			requestor.getResults());
5116
}
5222
}
5117
public void testCompletionKeywordNew7() throws JavaModelException {
5223
public void testCompletionKeywordClass6() throws JavaModelException {
5118
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5224
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5119
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew7.java");
5225
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass6.java");
5120
5226
5121
		String str = cu.getSource();
5227
		String str = cu.getSource();
5122
		String completeBehind = "ne";
5228
		String completeBehind = "cla";
5123
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5229
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5124
		cu.codeComplete(cursorLocation, requestor);
5230
		cu.codeComplete(cursorLocation, requestor);
5125
5231
5126
		assertEquals(
5232
		assertEquals(
5127
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5233
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5234
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5235
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5128
			requestor.getResults());
5236
			requestor.getResults());
5129
}
5237
}
5130
public void testCompletionKeywordNew8() throws JavaModelException {
5238
public void testCompletionKeywordClass7() throws JavaModelException {
5131
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5239
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5132
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew8.java");
5240
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass7.java");
5133
5241
5134
		String str = cu.getSource();
5242
		String str = cu.getSource();
5135
		String completeBehind = "ne";
5243
		String completeBehind = "cla";
5136
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5244
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5137
		cu.codeComplete(cursorLocation, requestor);
5245
		cu.codeComplete(cursorLocation, requestor);
5138
5246
5139
		assertEquals(
5247
		assertEquals(
5140
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5248
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5249
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5250
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5141
			requestor.getResults());
5251
			requestor.getResults());
5142
}
5252
}
5143
public void testCompletionKeywordStatic1() throws JavaModelException {
5253
public void testCompletionKeywordClass8() throws JavaModelException {
5144
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5254
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5145
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic1.java");
5255
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass8.java");
5146
5256
5147
		String str = cu.getSource();
5257
		String str = cu.getSource();
5148
		String completeBehind = "sta";
5258
		String completeBehind = "cla";
5149
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5259
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5150
		cu.codeComplete(cursorLocation, requestor);
5260
		cu.codeComplete(cursorLocation, requestor);
5151
5261
5152
		assertEquals(
5262
		assertEquals(
5153
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5263
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5264
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5265
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5154
			requestor.getResults());
5266
			requestor.getResults());
5155
}
5267
}
5156
public void testCompletionKeywordStatic2() throws JavaModelException {
5268
public void testCompletionKeywordClass9() throws JavaModelException {
5157
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5269
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5158
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic2.java");
5270
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass9.java");
5159
5271
5160
		String str = cu.getSource();
5272
		String str = cu.getSource();
5161
		String completeBehind = "sta";
5273
		String completeBehind = "cla";
5162
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5274
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5163
		cu.codeComplete(cursorLocation, requestor);
5275
		cu.codeComplete(cursorLocation, requestor);
5164
5276
5165
		assertEquals(
5277
		assertEquals(
5166
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5278
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5279
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5280
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5167
			requestor.getResults());
5281
			requestor.getResults());
5168
}
5282
}
5169
public void testCompletionKeywordStatic3() throws JavaModelException {
5283
public void testCompletionKeywordClass10() throws JavaModelException {
5170
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5284
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5171
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic3.java");
5285
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass10.java");
5172
5286
5173
		String str = cu.getSource();
5287
		String str = cu.getSource();
5174
		String completeBehind = "sta";
5288
		String completeBehind = "cla";
5175
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5289
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5176
		cu.codeComplete(cursorLocation, requestor);
5290
		cu.codeComplete(cursorLocation, requestor);
5177
5291
5178
		assertEquals(
5292
		assertEquals(
5179
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5293
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5294
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5295
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5180
			requestor.getResults());
5296
			requestor.getResults());
5181
}
5297
}
5182
public void testCompletionKeywordStatic4() throws JavaModelException {
5298
public void testCompletionKeywordClass11() throws JavaModelException {
5183
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5299
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5184
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic4.java");
5300
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass11.java");
5185
5301
5186
		String str = cu.getSource();
5302
		String str = cu.getSource();
5187
		String completeBehind = "sta";
5303
		String completeBehind = "cla";
5188
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5304
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5189
		cu.codeComplete(cursorLocation, requestor);
5305
		cu.codeComplete(cursorLocation, requestor);
5190
5306
5191
		assertEquals(
5307
		assertEquals(
5192
			"",
5308
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5309
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5310
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5193
			requestor.getResults());
5311
			requestor.getResults());
5194
}
5312
}
5195
public void testCompletionKeywordStatic5() throws JavaModelException {
5313
public void testCompletionKeywordClass12() throws JavaModelException {
5196
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5314
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5197
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic5.java");
5315
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass12.java");
5198
5316
5199
		String str = cu.getSource();
5317
		String str = cu.getSource();
5200
		String completeBehind = "sta";
5318
		String completeBehind = "cla";
5201
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5319
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5202
		cu.codeComplete(cursorLocation, requestor);
5320
		cu.codeComplete(cursorLocation, requestor);
5203
5321
5204
		assertEquals(
5322
		assertEquals(
5205
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5323
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5324
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
5325
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5206
			requestor.getResults());
5326
			requestor.getResults());
5207
}
5327
}
5208
public void testCompletionKeywordPublic1() throws JavaModelException {
5328
public void testCompletionKeywordInterface1() throws JavaModelException {
5209
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5329
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5210
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic1.java");
5330
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
5211
5331
5212
		String str = cu.getSource();
5332
		String str = cu.getSource();
5213
		String completeBehind = "pub";
5333
		String completeBehind = "interf";
5214
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5334
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5215
		cu.codeComplete(cursorLocation, requestor);
5335
		cu.codeComplete(cursorLocation, requestor);
5216
5336
5217
		assertEquals(
5337
		assertEquals(
5218
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5338
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5219
			requestor.getResults());
5339
			requestor.getResults());
5220
}
5340
}
5221
public void testCompletionKeywordPublic2() throws JavaModelException {
5341
public void testCompletionKeywordInterface2() throws JavaModelException {
5222
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5342
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5223
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic2.java");
5343
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface2.java");
5224
5344
5225
		String str = cu.getSource();
5345
		String str = cu.getSource();
5226
		String completeBehind = "pub";
5346
		String completeBehind = "interf";
5227
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5347
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5228
		cu.codeComplete(cursorLocation, requestor);
5348
		cu.codeComplete(cursorLocation, requestor);
5229
5349
5230
		assertEquals(
5350
		assertEquals(
5231
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5351
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5232
			requestor.getResults());
5352
			requestor.getResults());
5233
}
5353
}
5234
public void testCompletionKeywordPublic3() throws JavaModelException {
5354
public void testCompletionKeywordInterface3() throws JavaModelException {
5235
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5355
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5236
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic3.java");
5356
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface3.java");
5237
5357
5238
		String str = cu.getSource();
5358
		String str = cu.getSource();
5239
		String completeBehind = "pub";
5359
		String completeBehind = "interf";
5240
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5360
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5241
		cu.codeComplete(cursorLocation, requestor);
5361
		cu.codeComplete(cursorLocation, requestor);
5242
5362
5243
		assertEquals(
5363
		assertEquals(
5244
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5364
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5245
			requestor.getResults());
5365
			requestor.getResults());
5246
}
5366
}
5247
public void testCompletionKeywordPublic4() throws JavaModelException {
5367
public void testCompletionKeywordInterface4() throws JavaModelException {
5248
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5368
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5249
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic4.java");
5369
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface4.java");
5250
5370
5251
		String str = cu.getSource();
5371
		String str = cu.getSource();
5252
		String completeBehind = "pub";
5372
		String completeBehind = "interf";
5253
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5373
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5254
		cu.codeComplete(cursorLocation, requestor);
5374
		cu.codeComplete(cursorLocation, requestor);
5255
5375
5256
		assertEquals(
5376
		assertEquals(
5257
			"",
5377
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5258
			requestor.getResults());
5378
			requestor.getResults());
5259
}
5379
}
5260
public void testCompletionKeywordPublic5() throws JavaModelException {
5380
public void testCompletionKeywordInterface5() throws JavaModelException {
5261
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5381
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5262
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic5.java");
5382
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface5.java");
5263
5383
5264
		String str = cu.getSource();
5384
		String str = cu.getSource();
5265
		String completeBehind = "pub";
5385
		String completeBehind = "interf";
5266
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5386
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5267
		cu.codeComplete(cursorLocation, requestor);
5387
		cu.codeComplete(cursorLocation, requestor);
5268
5388
5269
		assertEquals(
5389
		assertEquals(
5270
			"",
5390
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5271
			requestor.getResults());
5391
			requestor.getResults());
5272
}
5392
}
5273
public void testCompletionKeywordPublic6() throws JavaModelException {
5393
public void testCompletionKeywordInterface6() throws JavaModelException {
5274
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5394
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5275
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic6.java");
5395
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface6.java");
5276
5396
5277
		String str = cu.getSource();
5397
		String str = cu.getSource();
5278
		String completeBehind = "pub";
5398
		String completeBehind = "interf";
5279
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5399
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5280
		cu.codeComplete(cursorLocation, requestor);
5400
		cu.codeComplete(cursorLocation, requestor);
5281
5401
5282
		assertEquals(
5402
		assertEquals(
5283
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5403
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5284
			requestor.getResults());
5404
			requestor.getResults());
5285
}
5405
}
5286
public void testCompletionKeywordPublic7() throws JavaModelException {
5406
public void testCompletionKeywordInterface7() throws JavaModelException {
5287
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5407
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5288
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic7.java");
5408
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface7.java");
5289
5409
5290
		String str = cu.getSource();
5410
		String str = cu.getSource();
5291
		String completeBehind = "pub";
5411
		String completeBehind = "interf";
5292
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5412
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5293
		cu.codeComplete(cursorLocation, requestor);
5413
		cu.codeComplete(cursorLocation, requestor);
5294
5414
5295
		assertEquals(
5415
		assertEquals(
5296
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5416
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5297
			requestor.getResults());
5417
			requestor.getResults());
5298
}
5418
}
5299
public void testCompletionKeywordPublic8() throws JavaModelException {
5419
public void testCompletionKeywordInterface8() throws JavaModelException {
5300
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5420
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5301
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic8.java");
5421
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface8.java");
5302
5422
5303
		String str = cu.getSource();
5423
		String str = cu.getSource();
5304
		String completeBehind = "pub";
5424
		String completeBehind = "interf";
5305
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5425
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5306
		cu.codeComplete(cursorLocation, requestor);
5426
		cu.codeComplete(cursorLocation, requestor);
5307
5427
5308
		assertEquals(
5428
		assertEquals(
5309
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5429
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5310
			requestor.getResults());
5430
			requestor.getResults());
5311
}
5431
}
5312
public void testCompletionKeywordPublic9() throws JavaModelException {
5432
public void testCompletionKeywordInterface9() throws JavaModelException {
5313
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5433
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5314
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic9.java");
5434
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface9.java");
5315
5435
5316
		String str = cu.getSource();
5436
		String str = cu.getSource();
5317
		String completeBehind = "pub";
5437
		String completeBehind = "interf";
5318
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5438
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5319
		cu.codeComplete(cursorLocation, requestor);
5439
		cu.codeComplete(cursorLocation, requestor);
5320
5440
5321
		assertEquals(
5441
		assertEquals(
5322
			"",
5442
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5323
			requestor.getResults());
5443
			requestor.getResults());
5324
}
5444
}
5325
public void testCompletionKeywordPublic10() throws JavaModelException {
5445
public void testCompletionKeywordThrows1() throws JavaModelException {
5326
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5446
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5327
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
5447
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows1.java");
5328
5448
5329
		String str = cu.getSource();
5449
		String str = cu.getSource();
5330
		String completeBehind = "pub";
5450
		String completeBehind = "thro";
5331
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5451
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5332
		cu.codeComplete(cursorLocation, requestor);
5452
		cu.codeComplete(cursorLocation, requestor);
5333
5453
5334
		assertEquals(
5454
		assertEquals(
5335
			"",
5455
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5336
			requestor.getResults());
5456
			requestor.getResults());
5337
}
5457
}
5338
public void testCompletionKeywordPrivate1() throws JavaModelException {
5458
public void testCompletionKeywordThrows2() throws JavaModelException {
5339
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5459
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5340
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate1.java");
5460
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows2.java");
5341
5461
5342
		String str = cu.getSource();
5462
		String str = cu.getSource();
5343
		String completeBehind = "pri";
5463
		String completeBehind = "thro";
5344
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5464
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5345
		cu.codeComplete(cursorLocation, requestor);
5465
		cu.codeComplete(cursorLocation, requestor);
5346
5466
5347
		assertEquals(
5467
		assertEquals(
5348
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5468
			"",
5349
			requestor.getResults());
5469
			requestor.getResults());
5350
}
5470
}
5351
public void testCompletionKeywordPrivate2() throws JavaModelException {
5471
public void testCompletionKeywordThrows3() throws JavaModelException {
5352
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5472
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5353
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate2.java");
5473
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows3.java");
5354
5474
5355
		String str = cu.getSource();
5475
		String str = cu.getSource();
5356
		String completeBehind = "pri";
5476
		String completeBehind = "thro";
5357
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5477
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5358
		cu.codeComplete(cursorLocation, requestor);
5478
		cu.codeComplete(cursorLocation, requestor);
5359
5479
5360
		assertEquals(
5480
		assertEquals(
5361
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5481
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5362
			requestor.getResults());
5482
			requestor.getResults());
5363
}
5483
}
5364
public void testCompletionKeywordPrivate3() throws JavaModelException {
5484
public void testCompletionKeywordThrows4() throws JavaModelException {
5365
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5485
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5366
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate3.java");
5486
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows4.java");
5367
5487
5368
		String str = cu.getSource();
5488
		String str = cu.getSource();
5369
		String completeBehind = "pri";
5489
		String completeBehind = "thro";
5370
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5490
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5371
		cu.codeComplete(cursorLocation, requestor);
5491
		cu.codeComplete(cursorLocation, requestor);
5372
5492
5373
		assertEquals(
5493
		assertEquals(
5374
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5494
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5375
			requestor.getResults());
5495
			requestor.getResults());
5376
}
5496
}
5377
public void testCompletionKeywordPrivate4() throws JavaModelException {
5497
public void testCompletionKeywordSynchronized1() throws JavaModelException {
5378
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5498
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5379
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate4.java");
5499
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized1.java");
5380
5500
5381
		String str = cu.getSource();
5501
		String str = cu.getSource();
5382
		String completeBehind = "pri";
5502
		String completeBehind = "syn";
5383
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5503
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5384
		cu.codeComplete(cursorLocation, requestor);
5504
		cu.codeComplete(cursorLocation, requestor);
5385
5505
5386
		assertEquals(
5506
		assertEquals(
5387
			"",
5507
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5388
			requestor.getResults());
5508
			requestor.getResults());
5389
}
5509
}
5390
public void testCompletionKeywordPrivate5() throws JavaModelException {
5510
public void testCompletionKeywordSynchronized2() throws JavaModelException {
5391
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5511
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5392
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate5.java");
5512
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized2.java");
5393
5513
5394
		String str = cu.getSource();
5514
		String str = cu.getSource();
5395
		String completeBehind = "pri";
5515
		String completeBehind = "syn";
5396
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5516
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5397
		cu.codeComplete(cursorLocation, requestor);
5517
		cu.codeComplete(cursorLocation, requestor);
5398
5518
Lines 5400-5450 Link Here
5400
			"",
5520
			"",
5401
			requestor.getResults());
5521
			requestor.getResults());
5402
}
5522
}
5403
public void testCompletionKeywordProtected1() throws JavaModelException {
5523
public void testCompletionKeywordSynchronized3() throws JavaModelException {
5404
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5524
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5405
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected1.java");
5525
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized3.java");
5406
5526
5407
		String str = cu.getSource();
5527
		String str = cu.getSource();
5408
		String completeBehind = "pro";
5528
		String completeBehind = "syn";
5409
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5529
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5410
		cu.codeComplete(cursorLocation, requestor);
5530
		cu.codeComplete(cursorLocation, requestor);
5411
5531
5412
		assertEquals(
5532
		assertEquals(
5413
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5533
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5414
			requestor.getResults());
5534
			requestor.getResults());
5415
}
5535
}
5416
public void testCompletionKeywordProtected2() throws JavaModelException {
5536
public void testCompletionKeywordSynchronized4() throws JavaModelException {
5417
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5537
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5418
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected2.java");
5538
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized4.java");
5419
5539
5420
		String str = cu.getSource();
5540
		String str = cu.getSource();
5421
		String completeBehind = "pro";
5541
		String completeBehind = "syn";
5422
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5542
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5423
		cu.codeComplete(cursorLocation, requestor);
5543
		cu.codeComplete(cursorLocation, requestor);
5424
5544
5425
		assertEquals(
5545
		assertEquals(
5426
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5546
			"",
5427
			requestor.getResults());
5547
			requestor.getResults());
5428
}
5548
}
5429
public void testCompletionKeywordProtected3() throws JavaModelException {
5549
public void testCompletionKeywordSynchronized5() throws JavaModelException {
5430
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5550
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5431
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected3.java");
5551
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized5.java");
5432
5552
5433
		String str = cu.getSource();
5553
		String str = cu.getSource();
5434
		String completeBehind = "pro";
5554
		String completeBehind = "syn";
5435
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5555
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5436
		cu.codeComplete(cursorLocation, requestor);
5556
		cu.codeComplete(cursorLocation, requestor);
5437
5557
5438
		assertEquals(
5558
		assertEquals(
5439
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5559
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5440
			requestor.getResults());
5560
			requestor.getResults());
5441
}
5561
}
5442
public void testCompletionKeywordProtected4() throws JavaModelException {
5562
public void testCompletionKeywordSynchronized6() throws JavaModelException {
5443
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5563
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5444
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected4.java");
5564
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized6.java");
5445
5565
5446
		String str = cu.getSource();
5566
		String str = cu.getSource();
5447
		String completeBehind = "pro";
5567
		String completeBehind = "syn";
5448
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5568
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5449
		cu.codeComplete(cursorLocation, requestor);
5569
		cu.codeComplete(cursorLocation, requestor);
5450
5570
Lines 5452-5609 Link Here
5452
			"",
5572
			"",
5453
			requestor.getResults());
5573
			requestor.getResults());
5454
}
5574
}
5455
public void testCompletionKeywordProtected5() throws JavaModelException {
5575
public void testCompletionKeywordNative1() throws JavaModelException {
5456
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5576
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5457
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected5.java");
5577
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative1.java");
5458
5578
5459
		String str = cu.getSource();
5579
		String str = cu.getSource();
5460
		String completeBehind = "pro";
5580
		String completeBehind = "nat";
5461
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5581
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5462
		cu.codeComplete(cursorLocation, requestor);
5582
		cu.codeComplete(cursorLocation, requestor);
5463
5583
5464
		assertEquals(
5584
		assertEquals(
5465
			"",
5585
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5466
			requestor.getResults());
5586
			requestor.getResults());
5467
}
5587
}
5468
public void testCompletionKeywordFinal1() throws JavaModelException {
5588
public void testCompletionKeywordNative2() throws JavaModelException {
5469
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5589
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5470
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal1.java");
5590
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative2.java");
5471
5591
5472
		String str = cu.getSource();
5592
		String str = cu.getSource();
5473
		String completeBehind = "fin";
5593
		String completeBehind = "nat";
5474
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5594
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5475
		cu.codeComplete(cursorLocation, requestor);
5595
		cu.codeComplete(cursorLocation, requestor);
5476
5596
5477
		assertEquals(
5597
		assertEquals(
5478
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5598
			"",
5479
			requestor.getResults());
5599
			requestor.getResults());
5480
}
5600
}
5481
public void testCompletionKeywordFinal2() throws JavaModelException {
5601
public void testCompletionKeywordNative3() throws JavaModelException {
5482
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5602
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5483
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal2.java");
5603
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative3.java");
5484
5604
5485
		String str = cu.getSource();
5605
		String str = cu.getSource();
5486
		String completeBehind = "fin";
5606
		String completeBehind = "nat";
5487
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5607
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5488
		cu.codeComplete(cursorLocation, requestor);
5608
		cu.codeComplete(cursorLocation, requestor);
5489
5609
5490
		assertEquals(
5610
		assertEquals(
5491
			"",
5611
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5492
			requestor.getResults());
5612
			requestor.getResults());
5493
}
5613
}
5494
public void testCompletionKeywordFinal3() throws JavaModelException {
5614
public void testCompletionKeywordNative4() throws JavaModelException {
5495
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5615
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5496
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal3.java");
5616
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative4.java");
5497
5617
5498
		String str = cu.getSource();
5618
		String str = cu.getSource();
5499
		String completeBehind = "fin";
5619
		String completeBehind = "nat";
5500
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5620
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5501
		cu.codeComplete(cursorLocation, requestor);
5621
		cu.codeComplete(cursorLocation, requestor);
5502
5622
5503
		assertEquals(
5623
		assertEquals(
5504
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5624
			"",
5505
			requestor.getResults());
5625
			requestor.getResults());
5506
}
5626
}
5507
public void testCompletionKeywordFinal4() throws JavaModelException {
5627
public void testCompletionKeywordStrictfp1() throws JavaModelException {
5508
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5628
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5509
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal4.java");
5629
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp1.java");
5510
5630
5511
		String str = cu.getSource();
5631
		String str = cu.getSource();
5512
		String completeBehind = "fin";
5632
		String completeBehind = "stric";
5513
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5633
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5514
		cu.codeComplete(cursorLocation, requestor);
5634
		cu.codeComplete(cursorLocation, requestor);
5515
5635
5516
		assertEquals(
5636
		assertEquals(
5517
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5637
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5518
			requestor.getResults());
5638
			requestor.getResults());
5519
}
5639
}
5520
public void testCompletionKeywordFinal5() throws JavaModelException {
5640
public void testCompletionKeywordStrictfp2() throws JavaModelException {
5521
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5641
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5522
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal5.java");
5642
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp2.java");
5523
5643
5524
		String str = cu.getSource();
5644
		String str = cu.getSource();
5525
		String completeBehind = "fin";
5645
		String completeBehind = "stric";
5526
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5646
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5527
		cu.codeComplete(cursorLocation, requestor);
5647
		cu.codeComplete(cursorLocation, requestor);
5528
5648
5529
		assertEquals(
5649
		assertEquals(
5530
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
5650
			"",
5531
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
5532
			requestor.getResults());
5651
			requestor.getResults());
5533
}
5652
}
5534
public void testCompletionKeywordFinal6() throws JavaModelException {
5653
public void testCompletionKeywordStrictfp3() throws JavaModelException {
5535
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5654
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5536
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal6.java");
5655
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp3.java");
5537
5656
5538
		String str = cu.getSource();
5657
		String str = cu.getSource();
5539
		String completeBehind = "fin";
5658
		String completeBehind = "stric";
5540
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5659
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5541
		cu.codeComplete(cursorLocation, requestor);
5660
		cu.codeComplete(cursorLocation, requestor);
5542
5661
5543
		assertEquals(
5662
		assertEquals(
5544
			"",
5663
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5545
			requestor.getResults());
5664
			requestor.getResults());
5546
}
5665
}
5547
public void testCompletionKeywordFinal7() throws JavaModelException {
5666
public void testCompletionKeywordStrictfp4() throws JavaModelException {
5548
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5667
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5549
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal7.java");
5668
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp4.java");
5550
5669
5551
		String str = cu.getSource();
5670
		String str = cu.getSource();
5552
		String completeBehind = "fin";
5671
		String completeBehind = "stric";
5553
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5672
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5554
		cu.codeComplete(cursorLocation, requestor);
5673
		cu.codeComplete(cursorLocation, requestor);
5555
5674
5556
		assertEquals(
5675
		assertEquals(
5557
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
5676
			"",
5558
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
5559
			requestor.getResults());
5677
			requestor.getResults());
5560
}
5678
}
5561
public void testCompletionKeywordFinal8() throws JavaModelException {
5679
public void testCompletionKeywordVolatile1() throws JavaModelException {
5562
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5680
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5563
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal8.java");
5681
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile1.java");
5564
5682
5565
		String str = cu.getSource();
5683
		String str = cu.getSource();
5566
		String completeBehind = "fin";
5684
		String completeBehind = "vol";
5567
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5685
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5568
		cu.codeComplete(cursorLocation, requestor);
5686
		cu.codeComplete(cursorLocation, requestor);
5569
5687
5570
		assertEquals(
5688
		assertEquals(
5571
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5689
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5572
			requestor.getResults());
5690
			requestor.getResults());
5573
}
5691
}
5574
public void testCompletionKeywordFinal9() throws JavaModelException {
5692
public void testCompletionKeywordVolatile2() throws JavaModelException {
5575
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5693
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5576
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal9.java");
5694
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile2.java");
5577
5695
5578
		String str = cu.getSource();
5696
		String str = cu.getSource();
5579
		String completeBehind = "fin";
5697
		String completeBehind = "vol";
5580
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5698
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5581
		cu.codeComplete(cursorLocation, requestor);
5699
		cu.codeComplete(cursorLocation, requestor);
5582
5700
5583
		assertEquals(
5701
		assertEquals(
5584
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
5702
			"",
5585
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE +R_UNQUALIFIED+ R_NON_RESTRICTED),
5586
			requestor.getResults());
5703
			requestor.getResults());
5587
}
5704
}
5588
public void testCompletionKeywordAbstract1() throws JavaModelException {
5705
public void testCompletionKeywordVolatile3() throws JavaModelException {
5589
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5706
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5590
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract1.java");
5707
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile3.java");
5591
5708
5592
		String str = cu.getSource();
5709
		String str = cu.getSource();
5593
		String completeBehind = "abs";
5710
		String completeBehind = "vol";
5594
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5711
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5595
		cu.codeComplete(cursorLocation, requestor);
5712
		cu.codeComplete(cursorLocation, requestor);
5596
5713
5597
		assertEquals(
5714
		assertEquals(
5598
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5715
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5599
			requestor.getResults());
5716
			requestor.getResults());
5600
}
5717
}
5601
public void testCompletionKeywordAbstract2() throws JavaModelException {
5718
public void testCompletionKeywordVolatile4() throws JavaModelException {
5602
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5719
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5603
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract2.java");
5720
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile4.java");
5604
5721
5605
		String str = cu.getSource();
5722
		String str = cu.getSource();
5606
		String completeBehind = "abs";
5723
		String completeBehind = "vol";
5607
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5724
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5608
		cu.codeComplete(cursorLocation, requestor);
5725
		cu.codeComplete(cursorLocation, requestor);
5609
5726
Lines 5611-5661 Link Here
5611
			"",
5728
			"",
5612
			requestor.getResults());
5729
			requestor.getResults());
5613
}
5730
}
5614
public void testCompletionKeywordAbstract3() throws JavaModelException {
5731
public void testCompletionKeywordTransient1() throws JavaModelException {
5615
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5732
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5616
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract3.java");
5733
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient1.java");
5617
5734
5618
		String str = cu.getSource();
5735
		String str = cu.getSource();
5619
		String completeBehind = "abs";
5736
		String completeBehind = "tran";
5620
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5737
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5621
		cu.codeComplete(cursorLocation, requestor);
5738
		cu.codeComplete(cursorLocation, requestor);
5622
5739
5623
		assertEquals(
5740
		assertEquals(
5624
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5741
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5625
			requestor.getResults());
5742
			requestor.getResults());
5626
}
5743
}
5627
public void testCompletionKeywordAbstract4() throws JavaModelException {
5744
public void testCompletionKeywordTransient2() throws JavaModelException {
5628
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5745
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5629
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract4.java");
5746
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient2.java");
5630
5747
5631
		String str = cu.getSource();
5748
		String str = cu.getSource();
5632
		String completeBehind = "abs";
5749
		String completeBehind = "tran";
5633
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5750
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5634
		cu.codeComplete(cursorLocation, requestor);
5751
		cu.codeComplete(cursorLocation, requestor);
5635
5752
5636
		assertEquals(
5753
		assertEquals(
5637
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5754
			"",
5638
			requestor.getResults());
5755
			requestor.getResults());
5639
}
5756
}
5640
public void testCompletionKeywordAbstract5() throws JavaModelException {
5757
public void testCompletionKeywordTransient3() throws JavaModelException {
5641
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5758
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5642
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract5.java");
5759
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient3.java");
5643
5760
5644
		String str = cu.getSource();
5761
		String str = cu.getSource();
5645
		String completeBehind = "abs";
5762
		String completeBehind = "tran";
5646
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5763
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5647
		cu.codeComplete(cursorLocation, requestor);
5764
		cu.codeComplete(cursorLocation, requestor);
5648
5765
5649
		assertEquals(
5766
		assertEquals(
5650
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5767
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5651
			requestor.getResults());
5768
			requestor.getResults());
5652
}
5769
}
5653
public void testCompletionKeywordAbstract6() throws JavaModelException {
5770
public void testCompletionKeywordTransient4() throws JavaModelException {
5654
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5771
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5655
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract6.java");
5772
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient4.java");
5656
5773
5657
		String str = cu.getSource();
5774
		String str = cu.getSource();
5658
		String completeBehind = "abs";
5775
		String completeBehind = "tran";
5659
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5776
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5660
		cu.codeComplete(cursorLocation, requestor);
5777
		cu.codeComplete(cursorLocation, requestor);
5661
5778
Lines 5663-5896 Link Here
5663
			"",
5780
			"",
5664
			requestor.getResults());
5781
			requestor.getResults());
5665
}
5782
}
5666
public void testCompletionKeywordAbstract7() throws JavaModelException {
5783
public void testCompletionKeywordNew1() throws JavaModelException {
5667
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5784
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5668
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract7.java");
5785
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew1.java");
5669
5786
5670
		String str = cu.getSource();
5787
		String str = cu.getSource();
5671
		String completeBehind = "abs";
5788
		String completeBehind = "ne";
5672
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5789
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5673
		cu.codeComplete(cursorLocation, requestor);
5790
		cu.codeComplete(cursorLocation, requestor);
5674
5791
5675
		assertEquals(
5792
		assertEquals(
5676
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5793
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5677
			requestor.getResults());
5794
			requestor.getResults());
5678
}
5795
}
5679
public void testCompletionKeywordAbstract8() throws JavaModelException {
5796
public void testCompletionKeywordNew2() throws JavaModelException {
5680
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5797
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5681
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract8.java");
5798
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew2.java");
5682
5799
5683
		String str = cu.getSource();
5800
		String str = cu.getSource();
5684
		String completeBehind = "abs";
5801
		String completeBehind = "ne";
5685
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5802
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5686
		cu.codeComplete(cursorLocation, requestor);
5803
		cu.codeComplete(cursorLocation, requestor);
5687
5804
5688
		assertEquals(
5805
		assertEquals(
5689
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5806
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5690
			requestor.getResults());
5807
			requestor.getResults());
5691
}
5808
}
5692
public void testCompletionKeywordTrue1() throws JavaModelException {
5809
public void testCompletionKeywordNew3() throws JavaModelException {
5693
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5810
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5694
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue1.java");
5811
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew3.java");
5695
5812
5696
		String str = cu.getSource();
5813
		String str = cu.getSource();
5697
		String completeBehind = "tru";
5814
		String completeBehind = "ne";
5698
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5815
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5699
		cu.codeComplete(cursorLocation, requestor);
5816
		cu.codeComplete(cursorLocation, requestor);
5700
5817
5701
		assertEquals(
5818
		assertEquals(
5702
			"",
5819
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5703
			requestor.getResults());
5820
			requestor.getResults());
5704
}
5821
}
5705
public void testCompletionKeywordTrue2() throws JavaModelException {
5822
public void testCompletionKeywordNew4() throws JavaModelException {
5706
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5823
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5707
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue2.java");
5824
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew4.java");
5708
5825
5709
		String str = cu.getSource();
5826
		String str = cu.getSource();
5710
		String completeBehind = "tru";
5827
		String completeBehind = "ne";
5711
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5828
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5712
		cu.codeComplete(cursorLocation, requestor);
5829
		cu.codeComplete(cursorLocation, requestor);
5713
5830
5714
		assertEquals(
5831
		assertEquals(
5715
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
5832
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5716
			requestor.getResults());
5833
			requestor.getResults());
5717
}
5834
}
5718
public void testCompletionKeywordFalse1() throws JavaModelException {
5835
public void testCompletionKeywordNew5() throws JavaModelException {
5719
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5836
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5720
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse1.java");
5837
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew5.java");
5721
5838
5722
		String str = cu.getSource();
5839
		String str = cu.getSource();
5723
		String completeBehind = "fal";
5840
		String completeBehind = "ne";
5724
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5841
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5725
		cu.codeComplete(cursorLocation, requestor);
5842
		cu.codeComplete(cursorLocation, requestor);
5726
5843
5727
		assertEquals(
5844
		assertEquals(
5728
			"",
5845
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5729
			requestor.getResults());
5846
			requestor.getResults());
5730
}
5847
}
5731
public void testCompletionKeywordFalse2() throws JavaModelException {
5848
public void testCompletionKeywordNew6() throws JavaModelException {
5732
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5849
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5733
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse2.java");
5850
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew6.java");
5734
5851
5735
		String str = cu.getSource();
5852
		String str = cu.getSource();
5736
		String completeBehind = "fal";
5853
		String completeBehind = "ne";
5737
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5854
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5738
		cu.codeComplete(cursorLocation, requestor);
5855
		cu.codeComplete(cursorLocation, requestor);
5739
5856
5740
		assertEquals(
5857
		assertEquals(
5741
			"element:false    completion:false    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
5858
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5742
			requestor.getResults());
5859
			requestor.getResults());
5743
}
5860
}
5744
public void testCompletionKeywordNull1() throws JavaModelException {
5861
public void testCompletionKeywordNew7() throws JavaModelException {
5745
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5862
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5746
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull1.java");
5863
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew7.java");
5747
5864
5748
		String str = cu.getSource();
5865
		String str = cu.getSource();
5749
		String completeBehind = "nul";
5866
		String completeBehind = "ne";
5750
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5867
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5751
		cu.codeComplete(cursorLocation, requestor);
5868
		cu.codeComplete(cursorLocation, requestor);
5752
5869
5753
		assertEquals(
5870
		assertEquals(
5754
			"",
5871
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5755
			requestor.getResults());
5872
			requestor.getResults());
5756
}
5873
}
5757
public void testCompletionKeywordNull2() throws JavaModelException {
5874
public void testCompletionKeywordNew8() throws JavaModelException {
5758
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5875
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5759
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull2.java");
5876
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew8.java");
5760
5877
5761
		String str = cu.getSource();
5878
		String str = cu.getSource();
5762
		String completeBehind = "nul";
5879
		String completeBehind = "ne";
5763
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5880
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5764
		cu.codeComplete(cursorLocation, requestor);
5881
		cu.codeComplete(cursorLocation, requestor);
5765
5882
5766
		assertEquals(
5883
		assertEquals(
5767
			"element:null    completion:null    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5884
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5768
			requestor.getResults());
5885
			requestor.getResults());
5769
}
5886
}
5770
public void testCompletionKeywordInstanceof1() throws JavaModelException {
5887
public void testCompletionKeywordStatic1() throws JavaModelException {
5771
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5888
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5772
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof1.java");
5889
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic1.java");
5773
5890
5774
		String str = cu.getSource();
5891
		String str = cu.getSource();
5775
		String completeBehind = "ins";
5892
		String completeBehind = "sta";
5776
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5893
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5777
		cu.codeComplete(cursorLocation, requestor);
5894
		cu.codeComplete(cursorLocation, requestor);
5778
5895
5779
		assertEquals(
5896
		assertEquals(
5780
			"element:instanceof    completion:instanceof    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5897
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5781
			requestor.getResults());
5898
			requestor.getResults());
5782
}
5899
}
5783
public void testCompletionKeywordInstanceof2() throws JavaModelException {
5900
public void testCompletionKeywordStatic2() throws JavaModelException {
5784
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5901
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5785
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof2.java");
5902
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic2.java");
5786
5903
5787
		String str = cu.getSource();
5904
		String str = cu.getSource();
5788
		String completeBehind = "ins";
5905
		String completeBehind = "sta";
5789
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5906
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5790
		cu.codeComplete(cursorLocation, requestor);
5907
		cu.codeComplete(cursorLocation, requestor);
5791
5908
5792
		assertEquals(
5909
		assertEquals(
5793
			"",
5910
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5794
			requestor.getResults());
5911
			requestor.getResults());
5795
}
5912
}
5796
public void testCompletionKeywordInstanceof3() throws JavaModelException {
5913
public void testCompletionKeywordStatic3() throws JavaModelException {
5797
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5914
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5798
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof3.java");
5915
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic3.java");
5799
5916
5800
		String str = cu.getSource();
5917
		String str = cu.getSource();
5801
		String completeBehind = "ins";
5918
		String completeBehind = "sta";
5802
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5919
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5803
		cu.codeComplete(cursorLocation, requestor);
5920
		cu.codeComplete(cursorLocation, requestor);
5804
5921
5805
		assertEquals(
5922
		assertEquals(
5806
			"",
5923
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5807
			requestor.getResults());
5924
			requestor.getResults());
5808
}
5925
}
5809
5926
public void testCompletionKeywordStatic4() throws JavaModelException {
5810
public void testCompletionKeywordThis8() throws JavaModelException {
5811
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5927
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5812
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis8.java");
5928
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic4.java");
5813
5929
5814
		String str = cu.getSource();
5930
		String str = cu.getSource();
5815
		String completeBehind = "thi";
5931
		String completeBehind = "sta";
5816
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5932
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5817
		cu.codeComplete(cursorLocation, requestor);
5933
		cu.codeComplete(cursorLocation, requestor);
5818
5934
5819
		assertEquals(
5935
		assertEquals(
5820
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5936
			"",
5821
			requestor.getResults());
5937
			requestor.getResults());
5822
}
5938
}
5823
public void testCompletionKeywordThis9() throws JavaModelException {
5939
public void testCompletionKeywordStatic5() throws JavaModelException {
5824
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5940
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5825
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis9.java");
5941
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic5.java");
5826
5942
5827
		String str = cu.getSource();
5943
		String str = cu.getSource();
5828
		String completeBehind = "thi";
5944
		String completeBehind = "sta";
5829
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5945
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5830
		cu.codeComplete(cursorLocation, requestor);
5946
		cu.codeComplete(cursorLocation, requestor);
5831
5947
5832
		assertEquals(
5948
		assertEquals(
5833
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5949
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5834
			requestor.getResults());
5950
			requestor.getResults());
5835
}
5951
}
5836
public void testCompletionKeywordThis10() throws JavaModelException {
5952
public void testCompletionKeywordPublic1() throws JavaModelException {
5837
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5953
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5838
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis10.java");
5954
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic1.java");
5839
5955
5840
		String str = cu.getSource();
5956
		String str = cu.getSource();
5841
		String completeBehind = "thi";
5957
		String completeBehind = "pub";
5842
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5958
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5843
		cu.codeComplete(cursorLocation, requestor);
5959
		cu.codeComplete(cursorLocation, requestor);
5844
5960
5845
		assertEquals(
5961
		assertEquals(
5846
			"",
5962
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5847
			requestor.getResults());
5963
			requestor.getResults());
5848
}
5964
}
5849
public void testCompletionKeywordThis11() throws JavaModelException {
5965
public void testCompletionKeywordPublic2() throws JavaModelException {
5850
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5966
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5851
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis11.java");
5967
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic2.java");
5852
5968
5853
		String str = cu.getSource();
5969
		String str = cu.getSource();
5854
		String completeBehind = "thi";
5970
		String completeBehind = "pub";
5855
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5971
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5856
		cu.codeComplete(cursorLocation, requestor);
5972
		cu.codeComplete(cursorLocation, requestor);
5857
5973
5858
		assertEquals(
5974
		assertEquals(
5859
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5975
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5860
			requestor.getResults());
5976
			requestor.getResults());
5861
}
5977
}
5862
public void testCompletionKeywordThis12() throws JavaModelException {
5978
public void testCompletionKeywordPublic3() throws JavaModelException {
5863
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5979
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5864
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis12.java");
5980
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic3.java");
5865
5981
5866
		String str = cu.getSource();
5982
		String str = cu.getSource();
5867
		String completeBehind = "thi";
5983
		String completeBehind = "pub";
5868
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5984
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5869
		cu.codeComplete(cursorLocation, requestor);
5985
		cu.codeComplete(cursorLocation, requestor);
5870
5986
5871
		assertEquals(
5987
		assertEquals(
5872
			"",
5988
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5873
			requestor.getResults());
5989
			requestor.getResults());
5874
}
5990
}
5875
public void testCompletionKeywordThis13() throws JavaModelException {
5991
public void testCompletionKeywordPublic4() throws JavaModelException {
5876
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5992
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5877
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis13.java");
5993
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic4.java");
5878
5994
5879
		String str = cu.getSource();
5995
		String str = cu.getSource();
5880
		String completeBehind = "thi";
5996
		String completeBehind = "pub";
5881
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5997
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5882
		cu.codeComplete(cursorLocation, requestor);
5998
		cu.codeComplete(cursorLocation, requestor);
5883
5999
5884
		assertEquals(
6000
		assertEquals(
5885
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6001
			"",
5886
			requestor.getResults());
6002
			requestor.getResults());
5887
}
6003
}
5888
public void testCompletionKeywordThis14() throws JavaModelException {
6004
public void testCompletionKeywordPublic5() throws JavaModelException {
5889
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6005
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5890
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis14.java");
6006
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic5.java");
5891
6007
5892
		String str = cu.getSource();
6008
		String str = cu.getSource();
5893
		String completeBehind = "thi";
6009
		String completeBehind = "pub";
5894
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6010
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5895
		cu.codeComplete(cursorLocation, requestor);
6011
		cu.codeComplete(cursorLocation, requestor);
5896
6012
Lines 5898-6145 Link Here
5898
			"",
6014
			"",
5899
			requestor.getResults());
6015
			requestor.getResults());
5900
}
6016
}
5901
/*
6017
public void testCompletionKeywordPublic6() throws JavaModelException {
5902
 * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=42402
5903
 */
5904
public void testCompletionKeywordThis15() throws JavaModelException {
5905
	this.wc = getWorkingCopy(
5906
            "/Completion/src2/CompletionKeywordThis15.java",
5907
            "public class CompletionKeywordThis15 {\n" +
5908
            "	public class InnerClass {\n" +
5909
            "		public InnerClass() {\n" +
5910
            "			CompletionKeywordThis15 a = CompletionKeywordThis15.this;\n" +
5911
            "		}\n" +
5912
            "	}\n" +
5913
            "}");
5914
    
5915
    
5916
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
5917
    String str = this.wc.getSource();
5918
    String completeBehind = "CompletionKeywordThis15.";
5919
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5920
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
5921
5922
	assertResults(
5923
			"CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
5924
			"class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n"+
5925
			"this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
5926
		requestor.getResults());
5927
}
5928
public void testCompletionKeywordSuper7() throws JavaModelException {
5929
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6018
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5930
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper7.java");
6019
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic6.java");
5931
6020
5932
		String str = cu.getSource();
6021
		String str = cu.getSource();
5933
		String completeBehind = "sup";
6022
		String completeBehind = "pub";
5934
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6023
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5935
		cu.codeComplete(cursorLocation, requestor);
6024
		cu.codeComplete(cursorLocation, requestor);
5936
6025
5937
		assertEquals(
6026
		assertEquals(
5938
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6027
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5939
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
5940
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5941
			requestor.getResults());
6028
			requestor.getResults());
5942
}
6029
}
5943
public void testCompletionKeywordSuper8() throws JavaModelException {
6030
public void testCompletionKeywordPublic7() throws JavaModelException {
5944
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6031
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5945
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper8.java");
6032
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic7.java");
5946
6033
5947
		String str = cu.getSource();
6034
		String str = cu.getSource();
5948
		String completeBehind = "sup";
6035
		String completeBehind = "pub";
5949
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6036
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5950
		cu.codeComplete(cursorLocation, requestor);
6037
		cu.codeComplete(cursorLocation, requestor);
5951
6038
5952
		assertEquals(
6039
		assertEquals(
5953
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6040
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5954
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
5955
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5956
			requestor.getResults());
6041
			requestor.getResults());
5957
}
6042
}
5958
public void testCompletionKeywordSuper9() throws JavaModelException {
6043
public void testCompletionKeywordPublic8() throws JavaModelException {
5959
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6044
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5960
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper9.java");
6045
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic8.java");
5961
6046
5962
		String str = cu.getSource();
6047
		String str = cu.getSource();
5963
		String completeBehind = "sup";
6048
		String completeBehind = "pub";
5964
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6049
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5965
		cu.codeComplete(cursorLocation, requestor);
6050
		cu.codeComplete(cursorLocation, requestor);
5966
6051
5967
		assertEquals(
6052
		assertEquals(
5968
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6053
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5969
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
5970
			requestor.getResults());
6054
			requestor.getResults());
5971
}
6055
}
5972
public void testCompletionKeywordSuper10() throws JavaModelException {
6056
public void testCompletionKeywordPublic9() throws JavaModelException {
5973
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6057
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5974
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper10.java");
6058
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic9.java");
5975
6059
5976
		String str = cu.getSource();
6060
		String str = cu.getSource();
5977
		String completeBehind = "sup";
6061
		String completeBehind = "pub";
5978
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6062
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5979
		cu.codeComplete(cursorLocation, requestor);
6063
		cu.codeComplete(cursorLocation, requestor);
5980
6064
5981
		assertEquals(
6065
		assertEquals(
5982
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6066
			"",
5983
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
5984
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
5985
			requestor.getResults());
6067
			requestor.getResults());
5986
}
6068
}
5987
public void testCompletionKeywordSuper11() throws JavaModelException {
6069
public void testCompletionKeywordPublic10() throws JavaModelException {
5988
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6070
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
5989
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper11.java");
6071
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
5990
6072
5991
		String str = cu.getSource();
6073
		String str = cu.getSource();
5992
		String completeBehind = "sup";
6074
		String completeBehind = "pub";
5993
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6075
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
5994
		cu.codeComplete(cursorLocation, requestor);
6076
		cu.codeComplete(cursorLocation, requestor);
5995
6077
5996
		assertEquals(
6078
		assertEquals(
5997
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6079
			"",
5998
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
5999
			requestor.getResults());
6000
}
6001
public void testCompletionKeywordSuper12() throws JavaModelException {
6002
	this.wc = getWorkingCopy(
6003
            "/Completion/src2/CompletionKeywordSuper12.java",
6004
            "public class CompletionKeywordSuper12 {\n"+
6005
            "	public CompletionKeywordSuper12() {\n"+
6006
            "		#\n"+
6007
            "		sup\n"+
6008
            "	}\n"+
6009
            "}");
6010
    
6011
    
6012
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
6013
    
6014
    String str = this.wc.getSource();
6015
    String completeBehind = "sup";
6016
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6017
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
6018
6019
    assertResults(
6020
            "expectedTypesSignatures=null\n"+
6021
            "expectedTypesKeys=null",
6022
            requestor.getContext());
6023
    
6024
    assertResults(
6025
            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
6026
			"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
6027
			"super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" +
6028
			"super[METHOD_REF<CONSTRUCTOR>]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
6029
			requestor.getResults());
6080
			requestor.getResults());
6030
}
6081
}
6031
public void testCompletionKeywordTry4() throws JavaModelException {
6082
public void testCompletionKeywordPrivate1() throws JavaModelException {
6032
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6083
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6033
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry4.java");
6084
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate1.java");
6034
6085
6035
		String str = cu.getSource();
6086
		String str = cu.getSource();
6036
		String completeBehind = "tr";
6087
		String completeBehind = "pri";
6037
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6088
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6038
		cu.codeComplete(cursorLocation, requestor);
6089
		cu.codeComplete(cursorLocation, requestor);
6039
6090
6040
		assertEquals(
6091
		assertEquals(
6041
			"element:try    completion:try    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6092
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6042
			requestor.getResults());
6093
			requestor.getResults());
6043
}
6094
}
6044
public void testCompletionKeywordTry5() throws JavaModelException {
6095
public void testCompletionKeywordPrivate2() throws JavaModelException {
6045
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6096
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6046
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry5.java");
6097
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate2.java");
6047
6098
6048
		String str = cu.getSource();
6099
		String str = cu.getSource();
6049
		String completeBehind = "tr";
6100
		String completeBehind = "pri";
6050
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6101
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6051
		cu.codeComplete(cursorLocation, requestor);
6102
		cu.codeComplete(cursorLocation, requestor);
6052
6103
6053
		assertEquals(
6104
		assertEquals(
6054
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
6105
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6055
			requestor.getResults());
6106
			requestor.getResults());
6056
}
6107
}
6057
public void testCompletionKeywordTry6() throws JavaModelException {
6108
public void testCompletionKeywordPrivate3() throws JavaModelException {
6058
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6109
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6059
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry6.java");
6110
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate3.java");
6060
6111
6061
		String str = cu.getSource();
6112
		String str = cu.getSource();
6062
		String completeBehind = "try";
6113
		String completeBehind = "pri";
6063
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6114
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6064
		cu.codeComplete(cursorLocation, requestor);
6115
		cu.codeComplete(cursorLocation, requestor);
6065
6116
6066
		assertEquals(
6117
		assertEquals(
6067
			"",
6118
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6068
			requestor.getResults());
6119
			requestor.getResults());
6069
}
6120
}
6070
public void testCompletionKeywordDo4() throws JavaModelException {
6121
public void testCompletionKeywordPrivate4() throws JavaModelException {
6071
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6122
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6072
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo4.java");
6123
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate4.java");
6073
6124
6074
		String str = cu.getSource();
6125
		String str = cu.getSource();
6075
		String completeBehind = "do";
6126
		String completeBehind = "pri";
6076
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6127
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6077
		cu.codeComplete(cursorLocation, requestor);
6128
		cu.codeComplete(cursorLocation, requestor);
6078
6129
6079
		assertEquals(
6130
		assertEquals(
6080
			"element:do    completion:do    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+
6131
			"",
6081
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6082
			requestor.getResults());
6132
			requestor.getResults());
6083
}
6133
}
6084
public void testCompletionKeywordDo5() throws JavaModelException {
6134
public void testCompletionKeywordPrivate5() throws JavaModelException {
6085
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6135
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6086
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo5.java");
6136
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate5.java");
6087
6137
6088
		String str = cu.getSource();
6138
		String str = cu.getSource();
6089
		String completeBehind = "do";
6139
		String completeBehind = "pri";
6090
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6140
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6091
		cu.codeComplete(cursorLocation, requestor);
6141
		cu.codeComplete(cursorLocation, requestor);
6092
6142
6093
		assertEquals(
6143
		assertEquals(
6094
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6144
			"",
6095
			requestor.getResults());
6145
			requestor.getResults());
6096
}
6146
}
6097
public void testCompletionKeywordDo6() throws JavaModelException {
6147
public void testCompletionKeywordProtected1() throws JavaModelException {
6098
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6148
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6099
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo6.java");
6149
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected1.java");
6100
6150
6101
		String str = cu.getSource();
6151
		String str = cu.getSource();
6102
		String completeBehind = "do";
6152
		String completeBehind = "pro";
6103
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6153
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6104
		cu.codeComplete(cursorLocation, requestor);
6154
		cu.codeComplete(cursorLocation, requestor);
6105
6155
6106
		assertEquals(
6156
		assertEquals(
6107
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6157
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6108
			requestor.getResults());
6158
			requestor.getResults());
6109
}
6159
}
6110
public void testCompletionKeywordFor4() throws JavaModelException {
6160
public void testCompletionKeywordProtected2() throws JavaModelException {
6111
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6161
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6112
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor4.java");
6162
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected2.java");
6113
6163
6114
		String str = cu.getSource();
6164
		String str = cu.getSource();
6115
		String completeBehind = "fo";
6165
		String completeBehind = "pro";
6116
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6166
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6117
		cu.codeComplete(cursorLocation, requestor);
6167
		cu.codeComplete(cursorLocation, requestor);
6118
6168
6119
		assertEquals(
6169
		assertEquals(
6120
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
6170
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6121
			"element:for    completion:for    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6122
			requestor.getResults());
6171
			requestor.getResults());
6123
}
6172
}
6124
public void testCompletionKeywordFor5() throws JavaModelException {
6173
public void testCompletionKeywordProtected3() throws JavaModelException {
6125
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6174
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6126
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor5.java");
6175
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected3.java");
6127
6176
6128
		String str = cu.getSource();
6177
		String str = cu.getSource();
6129
		String completeBehind = "fo";
6178
		String completeBehind = "pro";
6130
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6179
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6131
		cu.codeComplete(cursorLocation, requestor);
6180
		cu.codeComplete(cursorLocation, requestor);
6132
6181
6133
		assertEquals(
6182
		assertEquals(
6134
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
6183
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6135
			requestor.getResults());
6184
			requestor.getResults());
6136
}
6185
}
6137
public void testCompletionKeywordFor6() throws JavaModelException {
6186
public void testCompletionKeywordProtected4() throws JavaModelException {
6138
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6187
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6139
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor6.java");
6188
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected4.java");
6140
6189
6141
		String str = cu.getSource();
6190
		String str = cu.getSource();
6142
		String completeBehind = "fo";
6191
		String completeBehind = "pro";
6143
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6192
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6144
		cu.codeComplete(cursorLocation, requestor);
6193
		cu.codeComplete(cursorLocation, requestor);
6145
6194
Lines 6147-6184 Link Here
6147
			"",
6196
			"",
6148
			requestor.getResults());
6197
			requestor.getResults());
6149
}
6198
}
6150
public void testCompletionKeywordIf4() throws JavaModelException {
6199
public void testCompletionKeywordProtected5() throws JavaModelException {
6151
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6200
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6152
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf4.java");
6201
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected5.java");
6153
6202
6154
		String str = cu.getSource();
6203
		String str = cu.getSource();
6155
		String completeBehind = "if";
6204
		String completeBehind = "pro";
6156
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6205
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6157
		cu.codeComplete(cursorLocation, requestor);
6206
		cu.codeComplete(cursorLocation, requestor);
6158
6207
6159
		assertEquals(
6208
		assertEquals(
6160
			"element:if    completion:if    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
6209
			"",
6161
			requestor.getResults());
6210
			requestor.getResults());
6162
}
6211
}
6163
public void testCompletionKeywordIf5() throws JavaModelException {
6212
public void testCompletionKeywordFinal1() throws JavaModelException {
6164
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6213
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6165
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf5.java");
6214
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal1.java");
6166
6215
6167
		String str = cu.getSource();
6216
		String str = cu.getSource();
6168
		String completeBehind = "if";
6217
		String completeBehind = "fin";
6169
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6218
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6170
		cu.codeComplete(cursorLocation, requestor);
6219
		cu.codeComplete(cursorLocation, requestor);
6171
6220
6172
		assertEquals(
6221
		assertEquals(
6173
			"",
6222
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6174
			requestor.getResults());
6223
			requestor.getResults());
6175
}
6224
}
6176
public void testCompletionKeywordIf6() throws JavaModelException {
6225
public void testCompletionKeywordFinal2() throws JavaModelException {
6177
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6226
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6178
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf6.java");
6227
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal2.java");
6179
6228
6180
		String str = cu.getSource();
6229
		String str = cu.getSource();
6181
		String completeBehind = "if";
6230
		String completeBehind = "fin";
6182
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6231
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6183
		cu.codeComplete(cursorLocation, requestor);
6232
		cu.codeComplete(cursorLocation, requestor);
6184
6233
Lines 6186-6393 Link Here
6186
			"",
6235
			"",
6187
			requestor.getResults());
6236
			requestor.getResults());
6188
}
6237
}
6189
public void testCompletionKeywordReturn4() throws JavaModelException {
6238
public void testCompletionKeywordFinal3() throws JavaModelException {
6190
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6239
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6191
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn4.java");
6240
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal3.java");
6192
6241
6193
		String str = cu.getSource();
6242
		String str = cu.getSource();
6194
		String completeBehind = "re";
6243
		String completeBehind = "fin";
6195
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6244
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6196
		cu.codeComplete(cursorLocation, requestor);
6245
		cu.codeComplete(cursorLocation, requestor);
6197
6246
6198
		assertEquals(
6247
		assertEquals(
6199
			"element:return    completion:return    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6248
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6200
			requestor.getResults());
6249
			requestor.getResults());
6201
}
6250
}
6202
public void testCompletionKeywordReturn5() throws JavaModelException {
6251
public void testCompletionKeywordFinal4() throws JavaModelException {
6203
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6252
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6204
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn5.java");
6253
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal4.java");
6205
6254
6206
		String str = cu.getSource();
6255
		String str = cu.getSource();
6207
		String completeBehind = "re";
6256
		String completeBehind = "fin";
6208
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6257
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6209
		cu.codeComplete(cursorLocation, requestor);
6258
		cu.codeComplete(cursorLocation, requestor);
6210
6259
6211
		assertEquals(
6260
		assertEquals(
6212
			"",
6261
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6213
			requestor.getResults());
6262
			requestor.getResults());
6214
}
6263
}
6215
public void testCompletionKeywordReturn6() throws JavaModelException {
6264
public void testCompletionKeywordFinal5() throws JavaModelException {
6216
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6265
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6217
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn6.java");
6266
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal5.java");
6218
6267
6219
		String str = cu.getSource();
6268
		String str = cu.getSource();
6220
		String completeBehind = "re";
6269
		String completeBehind = "fin";
6221
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6270
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6222
		cu.codeComplete(cursorLocation, requestor);
6271
		cu.codeComplete(cursorLocation, requestor);
6223
6272
6224
		assertEquals(
6273
		assertEquals(
6225
			"",
6274
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
6275
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
6226
			requestor.getResults());
6276
			requestor.getResults());
6227
}
6277
}
6228
public void testCompletionKeywordSwitch4() throws JavaModelException {
6278
public void testCompletionKeywordFinal6() throws JavaModelException {
6229
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6279
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6230
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch4.java");
6280
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal6.java");
6231
6281
6232
		String str = cu.getSource();
6282
		String str = cu.getSource();
6233
		String completeBehind = "sw";
6283
		String completeBehind = "fin";
6234
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6284
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6235
		cu.codeComplete(cursorLocation, requestor);
6285
		cu.codeComplete(cursorLocation, requestor);
6236
6286
6237
		assertEquals(
6287
		assertEquals(
6238
			"element:switch    completion:switch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6288
			"",
6239
			requestor.getResults());
6289
			requestor.getResults());
6240
}
6290
}
6241
public void testCompletionKeywordSwitch5() throws JavaModelException {
6291
public void testCompletionKeywordFinal7() throws JavaModelException {
6242
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6292
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6243
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch5.java");
6293
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal7.java");
6244
6294
6245
		String str = cu.getSource();
6295
		String str = cu.getSource();
6246
		String completeBehind = "sw";
6296
		String completeBehind = "fin";
6247
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6297
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6248
		cu.codeComplete(cursorLocation, requestor);
6298
		cu.codeComplete(cursorLocation, requestor);
6249
6299
6250
		assertEquals(
6300
		assertEquals(
6251
			"",
6301
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
6302
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
6252
			requestor.getResults());
6303
			requestor.getResults());
6253
}
6304
}
6254
public void testCompletionKeywordSwitch6() throws JavaModelException {
6305
public void testCompletionKeywordFinal8() throws JavaModelException {
6255
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6306
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6256
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch6.java");
6307
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal8.java");
6257
6308
6258
		String str = cu.getSource();
6309
		String str = cu.getSource();
6259
		String completeBehind = "sw";
6310
		String completeBehind = "fin";
6260
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6311
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6261
		cu.codeComplete(cursorLocation, requestor);
6312
		cu.codeComplete(cursorLocation, requestor);
6262
6313
6263
		assertEquals(
6314
		assertEquals(
6264
			"",
6315
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6265
			requestor.getResults());
6316
			requestor.getResults());
6266
}
6317
}
6267
public void testCompletionKeywordThrow4() throws JavaModelException {
6318
public void testCompletionKeywordFinal9() throws JavaModelException {
6268
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6319
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6269
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow4.java");
6320
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal9.java");
6270
6321
6271
		String str = cu.getSource();
6322
		String str = cu.getSource();
6272
		String completeBehind = "thr";
6323
		String completeBehind = "fin";
6273
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6324
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6274
		cu.codeComplete(cursorLocation, requestor);
6325
		cu.codeComplete(cursorLocation, requestor);
6275
6326
6276
		assertEquals(
6327
		assertEquals(
6277
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
6328
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
6278
			"element:throw    completion:throw    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6329
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE +R_UNQUALIFIED+ R_NON_RESTRICTED),
6279
			requestor.getResults());
6330
			requestor.getResults());
6280
}
6331
}
6281
public void testCompletionKeywordThrow5() throws JavaModelException {
6332
public void testCompletionKeywordAbstract1() throws JavaModelException {
6282
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6333
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6283
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow5.java");
6334
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract1.java");
6284
6335
6285
		String str = cu.getSource();
6336
		String str = cu.getSource();
6286
		String completeBehind = "thr";
6337
		String completeBehind = "abs";
6287
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6338
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6288
		cu.codeComplete(cursorLocation, requestor);
6339
		cu.codeComplete(cursorLocation, requestor);
6289
6340
6290
		assertEquals(
6341
		assertEquals(
6291
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6342
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6292
			requestor.getResults());
6343
			requestor.getResults());
6293
}
6344
}
6294
public void testCompletionKeywordThrow6() throws JavaModelException {
6345
public void testCompletionKeywordAbstract2() throws JavaModelException {
6295
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6346
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6296
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow6.java");
6347
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract2.java");
6297
6348
6298
		String str = cu.getSource();
6349
		String str = cu.getSource();
6299
		String completeBehind = "thr";
6350
		String completeBehind = "abs";
6300
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6351
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6301
		cu.codeComplete(cursorLocation, requestor);
6352
		cu.codeComplete(cursorLocation, requestor);
6302
6353
6303
		assertEquals(
6354
		assertEquals(
6304
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6355
			"",
6305
			requestor.getResults());
6356
			requestor.getResults());
6306
}
6357
}
6307
public void testCompletionKeywordAssert4() throws JavaModelException {
6358
public void testCompletionKeywordAbstract3() throws JavaModelException {
6308
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6359
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6309
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert4.java");
6360
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract3.java");
6310
6361
6311
		String str = cu.getSource();
6362
		String str = cu.getSource();
6312
		String completeBehind = "as";
6363
		String completeBehind = "abs";
6313
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6364
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6314
		cu.codeComplete(cursorLocation, requestor);
6365
		cu.codeComplete(cursorLocation, requestor);
6315
6366
6316
		assertEquals(
6367
		assertEquals(
6317
			"element:assert    completion:assert    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6368
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6318
			requestor.getResults());
6369
			requestor.getResults());
6319
}
6370
}
6320
public void testCompletionKeywordAssert5() throws JavaModelException {
6371
public void testCompletionKeywordAbstract4() throws JavaModelException {
6321
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6372
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6322
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert5.java");
6373
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract4.java");
6323
6374
6324
		String str = cu.getSource();
6375
		String str = cu.getSource();
6325
		String completeBehind = "as";
6376
		String completeBehind = "abs";
6326
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6377
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6327
		cu.codeComplete(cursorLocation, requestor);
6378
		cu.codeComplete(cursorLocation, requestor);
6328
6379
6329
		assertEquals(
6380
		assertEquals(
6330
			"",
6381
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6331
			requestor.getResults());
6382
			requestor.getResults());
6332
}
6383
}
6333
public void testCompletionKeywordAssert6() throws JavaModelException {
6384
public void testCompletionKeywordAbstract5() throws JavaModelException {
6334
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6385
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6335
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert6.java");
6386
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract5.java");
6336
6387
6337
		String str = cu.getSource();
6388
		String str = cu.getSource();
6338
		String completeBehind = "as";
6389
		String completeBehind = "abs";
6339
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6390
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6340
		cu.codeComplete(cursorLocation, requestor);
6391
		cu.codeComplete(cursorLocation, requestor);
6341
6392
6342
		assertEquals(
6393
		assertEquals(
6343
			"",
6394
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6344
			requestor.getResults());
6395
			requestor.getResults());
6345
}
6396
}
6346
public void testCompletionKeywordElse5() throws JavaModelException {
6397
public void testCompletionKeywordAbstract6() throws JavaModelException {
6347
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6398
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6348
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse5.java");
6399
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract6.java");
6349
6400
6350
		String str = cu.getSource();
6401
		String str = cu.getSource();
6351
		String completeBehind = "els";
6402
		String completeBehind = "abs";
6352
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6403
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6353
		cu.codeComplete(cursorLocation, requestor);
6404
		cu.codeComplete(cursorLocation, requestor);
6354
6405
6355
		assertEquals(
6406
		assertEquals(
6356
			"element:else    completion:else    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6407
			"",
6357
			requestor.getResults());
6408
			requestor.getResults());
6358
}
6409
}
6359
public void testCompletionKeywordElse6() throws JavaModelException {
6410
public void testCompletionKeywordAbstract7() throws JavaModelException {
6360
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6411
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6361
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse6.java");
6412
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract7.java");
6362
6413
6363
		String str = cu.getSource();
6414
		String str = cu.getSource();
6364
		String completeBehind = "els";
6415
		String completeBehind = "abs";
6365
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6416
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6366
		cu.codeComplete(cursorLocation, requestor);
6417
		cu.codeComplete(cursorLocation, requestor);
6367
6418
6368
		assertEquals(
6419
		assertEquals(
6369
			"",
6420
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6370
			requestor.getResults());
6421
			requestor.getResults());
6371
}
6422
}
6372
public void testCompletionKeywordElse7() throws JavaModelException {
6423
public void testCompletionKeywordAbstract8() throws JavaModelException {
6373
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6424
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6374
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse7.java");
6425
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract8.java");
6375
6426
6376
		String str = cu.getSource();
6427
		String str = cu.getSource();
6377
		String completeBehind = "els";
6428
		String completeBehind = "abs";
6378
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6429
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6379
		cu.codeComplete(cursorLocation, requestor);
6430
		cu.codeComplete(cursorLocation, requestor);
6380
6431
6381
		assertEquals(
6432
		assertEquals(
6382
			"",
6433
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6383
			requestor.getResults());
6434
			requestor.getResults());
6384
}
6435
}
6385
public void testCompletionKeywordElse8() throws JavaModelException {
6436
public void testCompletionKeywordTrue1() throws JavaModelException {
6386
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6437
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6387
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse8.java");
6438
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue1.java");
6388
6439
6389
		String str = cu.getSource();
6440
		String str = cu.getSource();
6390
		String completeBehind = "els";
6441
		String completeBehind = "tru";
6391
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6442
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6392
		cu.codeComplete(cursorLocation, requestor);
6443
		cu.codeComplete(cursorLocation, requestor);
6393
6444
Lines 6395-6419 Link Here
6395
			"",
6446
			"",
6396
			requestor.getResults());
6447
			requestor.getResults());
6397
}
6448
}
6398
public void testCompletionKeywordCatch6() throws JavaModelException {
6449
public void testCompletionKeywordTrue2() throws JavaModelException {
6399
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6450
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6400
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch6.java");
6451
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue2.java");
6401
6452
6402
		String str = cu.getSource();
6453
		String str = cu.getSource();
6403
		String completeBehind = "cat";
6454
		String completeBehind = "tru";
6404
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6455
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6405
		cu.codeComplete(cursorLocation, requestor);
6456
		cu.codeComplete(cursorLocation, requestor);
6406
6457
6407
		assertEquals(
6458
		assertEquals(
6408
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6459
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
6409
			requestor.getResults());
6460
			requestor.getResults());
6410
}
6461
}
6411
public void testCompletionKeywordCatch7() throws JavaModelException {
6462
public void testCompletionKeywordFalse1() throws JavaModelException {
6412
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6463
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6413
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch7.java");
6464
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse1.java");
6414
6465
6415
		String str = cu.getSource();
6466
		String str = cu.getSource();
6416
		String completeBehind = "cat";
6467
		String completeBehind = "fal";
6417
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6468
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6418
		cu.codeComplete(cursorLocation, requestor);
6469
		cu.codeComplete(cursorLocation, requestor);
6419
6470
Lines 6421-6445 Link Here
6421
			"",
6472
			"",
6422
			requestor.getResults());
6473
			requestor.getResults());
6423
}
6474
}
6424
public void testCompletionKeywordCatch8() throws JavaModelException {
6475
public void testCompletionKeywordFalse2() throws JavaModelException {
6425
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6476
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6426
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch8.java");
6477
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse2.java");
6427
6478
6428
		String str = cu.getSource();
6479
		String str = cu.getSource();
6429
		String completeBehind = "cat";
6480
		String completeBehind = "fal";
6430
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6481
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6431
		cu.codeComplete(cursorLocation, requestor);
6482
		cu.codeComplete(cursorLocation, requestor);
6432
6483
6433
		assertEquals(
6484
		assertEquals(
6434
			"",
6485
			"element:false    completion:false    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
6435
			requestor.getResults());
6486
			requestor.getResults());
6436
}
6487
}
6437
public void testCompletionKeywordCatch9() throws JavaModelException {
6488
public void testCompletionKeywordNull1() throws JavaModelException {
6438
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6489
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6439
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch9.java");
6490
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull1.java");
6440
6491
6441
		String str = cu.getSource();
6492
		String str = cu.getSource();
6442
		String completeBehind = "cat";
6493
		String completeBehind = "nul";
6443
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6494
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6444
		cu.codeComplete(cursorLocation, requestor);
6495
		cu.codeComplete(cursorLocation, requestor);
6445
6496
Lines 6447-6485 Link Here
6447
			"",
6498
			"",
6448
			requestor.getResults());
6499
			requestor.getResults());
6449
}
6500
}
6450
public void testCompletionKeywordCatch10() throws JavaModelException {
6501
public void testCompletionKeywordNull2() throws JavaModelException {
6451
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6502
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6452
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch10.java");
6503
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull2.java");
6453
6504
6454
		String str = cu.getSource();
6505
		String str = cu.getSource();
6455
		String completeBehind = "cat";
6506
		String completeBehind = "nul";
6456
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6507
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6457
		cu.codeComplete(cursorLocation, requestor);
6508
		cu.codeComplete(cursorLocation, requestor);
6458
6509
6459
		assertEquals(
6510
		assertEquals(
6460
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
6511
			"element:null    completion:null    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6461
			"element:catchz    completion:catchz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
6462
			requestor.getResults());
6512
			requestor.getResults());
6463
}
6513
}
6464
public void testCompletionKeywordFinally8() throws JavaModelException {
6514
public void testCompletionKeywordInstanceof1() throws JavaModelException {
6465
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6515
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6466
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally8.java");
6516
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof1.java");
6467
6517
6468
		String str = cu.getSource();
6518
		String str = cu.getSource();
6469
		String completeBehind = "finall";
6519
		String completeBehind = "ins";
6470
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6520
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6471
		cu.codeComplete(cursorLocation, requestor);
6521
		cu.codeComplete(cursorLocation, requestor);
6472
6522
6473
		assertEquals(
6523
		assertEquals(
6474
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6524
			"element:instanceof    completion:instanceof    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6475
			requestor.getResults());
6525
			requestor.getResults());
6476
}
6526
}
6477
public void testCompletionKeywordFinally9() throws JavaModelException {
6527
public void testCompletionKeywordInstanceof2() throws JavaModelException {
6478
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6528
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6479
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally9.java");
6529
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof2.java");
6480
6530
6481
		String str = cu.getSource();
6531
		String str = cu.getSource();
6482
		String completeBehind = "finall";
6532
		String completeBehind = "ins";
6483
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6533
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6484
		cu.codeComplete(cursorLocation, requestor);
6534
		cu.codeComplete(cursorLocation, requestor);
6485
6535
Lines 6487-6498 Link Here
6487
			"",
6537
			"",
6488
			requestor.getResults());
6538
			requestor.getResults());
6489
}
6539
}
6490
public void testCompletionKeywordFinally10() throws JavaModelException {
6540
public void testCompletionKeywordInstanceof3() throws JavaModelException {
6491
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6541
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6492
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally10.java");
6542
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof3.java");
6493
6543
6494
		String str = cu.getSource();
6544
		String str = cu.getSource();
6495
		String completeBehind = "finall";
6545
		String completeBehind = "ins";
6496
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6546
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6497
		cu.codeComplete(cursorLocation, requestor);
6547
		cu.codeComplete(cursorLocation, requestor);
6498
6548
Lines 6500-6798 Link Here
6500
			"",
6550
			"",
6501
			requestor.getResults());
6551
			requestor.getResults());
6502
}
6552
}
6503
public void testCompletionKeywordFinally11() throws JavaModelException {
6553
6554
public void testCompletionKeywordThis8() throws JavaModelException {
6504
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6555
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6505
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally11.java");
6556
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis8.java");
6506
6557
6507
		String str = cu.getSource();
6558
		String str = cu.getSource();
6508
		String completeBehind = "finall";
6559
		String completeBehind = "thi";
6509
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6560
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6510
		cu.codeComplete(cursorLocation, requestor);
6561
		cu.codeComplete(cursorLocation, requestor);
6511
6562
6512
		assertEquals(
6563
		assertEquals(
6513
			"",
6564
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6514
			requestor.getResults());
6565
			requestor.getResults());
6515
}
6566
}
6516
public void testCompletionKeywordFinally12() throws JavaModelException {
6567
public void testCompletionKeywordThis9() throws JavaModelException {
6517
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6568
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6518
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally12.java");
6569
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis9.java");
6519
6570
6520
		String str = cu.getSource();
6571
		String str = cu.getSource();
6521
		String completeBehind = "finall";
6572
		String completeBehind = "thi";
6522
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6573
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6523
		cu.codeComplete(cursorLocation, requestor);
6574
		cu.codeComplete(cursorLocation, requestor);
6524
6575
6525
		assertEquals(
6576
		assertEquals(
6526
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6577
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6527
			requestor.getResults());
6578
			requestor.getResults());
6528
}
6579
}
6529
public void testCompletionKeywordFinally13() throws JavaModelException {
6580
public void testCompletionKeywordThis10() throws JavaModelException {
6530
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6581
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6531
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally13.java");
6582
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis10.java");
6532
6583
6533
		String str = cu.getSource();
6584
		String str = cu.getSource();
6534
		String completeBehind = "finall";
6585
		String completeBehind = "thi";
6535
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6586
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6536
		cu.codeComplete(cursorLocation, requestor);
6587
		cu.codeComplete(cursorLocation, requestor);
6537
6588
6538
		assertEquals(
6589
		assertEquals(
6539
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
6590
			"",
6540
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
6541
			requestor.getResults());
6591
			requestor.getResults());
6542
}
6592
}
6543
public void testCompletionKeywordFinally14() throws JavaModelException {
6593
public void testCompletionKeywordThis11() throws JavaModelException {
6544
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6594
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6545
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally14.java");
6595
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis11.java");
6546
6596
6547
		String str = cu.getSource();
6597
		String str = cu.getSource();
6548
		String completeBehind = "finall";
6598
		String completeBehind = "thi";
6549
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6599
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6550
		cu.codeComplete(cursorLocation, requestor);
6600
		cu.codeComplete(cursorLocation, requestor);
6551
6601
6552
		assertEquals(
6602
		assertEquals(
6553
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
6603
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6554
			requestor.getResults());
6604
			requestor.getResults());
6555
}
6605
}
6556
public void testCompletionKeywordContinue3() throws JavaModelException {
6606
public void testCompletionKeywordThis12() throws JavaModelException {
6557
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6607
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6558
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue3.java");
6608
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis12.java");
6559
6609
6560
		String str = cu.getSource();
6610
		String str = cu.getSource();
6561
		String completeBehind = "cont";
6611
		String completeBehind = "thi";
6562
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6612
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6563
		cu.codeComplete(cursorLocation, requestor);
6613
		cu.codeComplete(cursorLocation, requestor);
6564
6614
6565
		assertEquals(
6615
		assertEquals(
6566
			"element:continue    completion:continue    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6616
			"",
6567
			requestor.getResults());
6617
			requestor.getResults());
6568
}
6618
}
6569
public void testCompletionKeywordContinue4() throws JavaModelException {
6619
public void testCompletionKeywordThis13() throws JavaModelException {
6570
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6620
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6571
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue4.java");
6621
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis13.java");
6572
6622
6573
		String str = cu.getSource();
6623
		String str = cu.getSource();
6574
		String completeBehind = "cont";
6624
		String completeBehind = "thi";
6575
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6625
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6576
		cu.codeComplete(cursorLocation, requestor);
6626
		cu.codeComplete(cursorLocation, requestor);
6577
6627
6578
		assertEquals(
6628
		assertEquals(
6579
			"",
6629
			"element:this    completion:this    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6580
			requestor.getResults());
6630
			requestor.getResults());
6581
}
6631
}
6582
public void testCompletionKeywordBreak4() throws JavaModelException {
6632
public void testCompletionKeywordThis14() throws JavaModelException {
6583
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6633
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6584
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak4.java");
6634
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThis14.java");
6585
6635
6586
		String str = cu.getSource();
6636
		String str = cu.getSource();
6587
		String completeBehind = "bre";
6637
		String completeBehind = "thi";
6588
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6638
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6589
		cu.codeComplete(cursorLocation, requestor);
6639
		cu.codeComplete(cursorLocation, requestor);
6590
6640
6591
		assertEquals(
6641
		assertEquals(
6592
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6642
			"",
6593
			requestor.getResults());
6643
			requestor.getResults());
6594
}
6644
}
6595
public void testCompletionKeywordBreak5() throws JavaModelException {
6645
/*
6646
 * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=42402
6647
 */
6648
public void testCompletionKeywordThis15() throws JavaModelException {
6649
	this.wc = getWorkingCopy(
6650
            "/Completion/src2/CompletionKeywordThis15.java",
6651
            "public class CompletionKeywordThis15 {\n" +
6652
            "	public class InnerClass {\n" +
6653
            "		public InnerClass() {\n" +
6654
            "			CompletionKeywordThis15 a = CompletionKeywordThis15.this;\n" +
6655
            "		}\n" +
6656
            "	}\n" +
6657
            "}");
6658
    
6659
    
6660
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
6661
    String str = this.wc.getSource();
6662
    String completeBehind = "CompletionKeywordThis15.";
6663
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6664
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
6665
6666
	assertResults(
6667
			"CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
6668
			"class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n"+
6669
			"this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
6670
		requestor.getResults());
6671
}
6672
public void testCompletionKeywordSuper7() throws JavaModelException {
6596
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6673
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6597
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak5.java");
6674
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper7.java");
6598
6675
6599
		String str = cu.getSource();
6676
		String str = cu.getSource();
6600
		String completeBehind = "bre";
6677
		String completeBehind = "sup";
6601
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6678
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6602
		cu.codeComplete(cursorLocation, requestor);
6679
		cu.codeComplete(cursorLocation, requestor);
6603
6680
6604
		assertEquals(
6681
		assertEquals(
6605
			"",
6682
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6683
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6684
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6606
			requestor.getResults());
6685
			requestor.getResults());
6607
}
6686
}
6608
public void testCompletionKeywordBreak6() throws JavaModelException {
6687
public void testCompletionKeywordSuper8() throws JavaModelException {
6609
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6688
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6610
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak6.java");
6689
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper8.java");
6611
6690
6612
		String str = cu.getSource();
6691
		String str = cu.getSource();
6613
		String completeBehind = "bre";
6692
		String completeBehind = "sup";
6614
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6693
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6615
		cu.codeComplete(cursorLocation, requestor);
6694
		cu.codeComplete(cursorLocation, requestor);
6616
6695
6617
		assertEquals(
6696
		assertEquals(
6618
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6697
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6698
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6699
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6619
			requestor.getResults());
6700
			requestor.getResults());
6620
}
6701
}
6621
public void testCompletionKeywordWhile6() throws JavaModelException {
6702
public void testCompletionKeywordSuper9() throws JavaModelException {
6622
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6703
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6623
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile6.java");
6704
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper9.java");
6624
6705
6625
		String str = cu.getSource();
6706
		String str = cu.getSource();
6626
		String completeBehind = "wh";
6707
		String completeBehind = "sup";
6627
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6708
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6628
		cu.codeComplete(cursorLocation, requestor);
6709
		cu.codeComplete(cursorLocation, requestor);
6629
6710
6630
		assertEquals(
6711
		assertEquals(
6631
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6712
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6713
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6632
			requestor.getResults());
6714
			requestor.getResults());
6633
}
6715
}
6634
public void testCompletionKeywordWhile7() throws JavaModelException {
6716
public void testCompletionKeywordSuper10() throws JavaModelException {
6635
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6717
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6636
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile7.java");
6718
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper10.java");
6637
6719
6638
		String str = cu.getSource();
6720
		String str = cu.getSource();
6639
		String completeBehind = "wh";
6721
		String completeBehind = "sup";
6640
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6722
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6641
		cu.codeComplete(cursorLocation, requestor);
6723
		cu.codeComplete(cursorLocation, requestor);
6642
6724
6643
		assertEquals(
6725
		assertEquals(
6644
			"",
6726
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6727
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6728
			"element:super    completion:super    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6645
			requestor.getResults());
6729
			requestor.getResults());
6646
}
6730
}
6647
public void testCompletionKeywordWhile8() throws JavaModelException {
6731
public void testCompletionKeywordSuper11() throws JavaModelException {
6648
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6732
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6649
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile8.java");
6733
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSuper11.java");
6650
6734
6651
		String str = cu.getSource();
6735
		String str = cu.getSource();
6652
		String completeBehind = "wh";
6736
		String completeBehind = "sup";
6653
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6737
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6654
		cu.codeComplete(cursorLocation, requestor);
6738
		cu.codeComplete(cursorLocation, requestor);
6655
6739
6656
		assertEquals(
6740
		assertEquals(
6657
			"",
6741
			"element:SuperClass    completion:SuperClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "\n" +
6742
			"element:SuperInterface    completion:SuperInterface    relevance:" + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6658
			requestor.getResults());
6743
			requestor.getResults());
6659
}
6744
}
6660
public void testCompletionKeywordWhile9() throws JavaModelException {
6745
public void testCompletionKeywordSuper12() throws JavaModelException {
6746
	this.wc = getWorkingCopy(
6747
            "/Completion/src2/CompletionKeywordSuper12.java",
6748
            "public class CompletionKeywordSuper12 {\n"+
6749
            "	public CompletionKeywordSuper12() {\n"+
6750
            "		#\n"+
6751
            "		sup\n"+
6752
            "	}\n"+
6753
            "}");
6754
    
6755
    
6756
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
6757
    
6758
    String str = this.wc.getSource();
6759
    String completeBehind = "sup";
6760
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6761
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
6762
6763
    assertResults(
6764
            "expectedTypesSignatures=null\n"+
6765
            "expectedTypesKeys=null",
6766
            requestor.getContext());
6767
    
6768
    assertResults(
6769
            "SuperClass[TYPE_REF]{SuperClass, , LSuperClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
6770
			"SuperInterface[TYPE_REF]{SuperInterface, , LSuperInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
6771
			"super[KEYWORD]{super, null, null, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED)+"}\n" +
6772
			"super[METHOD_REF<CONSTRUCTOR>]{super(), Ljava.lang.Object;, ()V, super, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
6773
			requestor.getResults());
6774
}
6775
public void testCompletionKeywordTry4() throws JavaModelException {
6661
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6776
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6662
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile9.java");
6777
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry4.java");
6663
6778
6664
		String str = cu.getSource();
6779
		String str = cu.getSource();
6665
		String completeBehind = "wh";
6780
		String completeBehind = "tr";
6666
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6781
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6667
		cu.codeComplete(cursorLocation, requestor);
6782
		cu.codeComplete(cursorLocation, requestor);
6668
6783
6669
		assertEquals(
6784
		assertEquals(
6670
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6785
			"element:try    completion:try    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6671
			requestor.getResults());
6786
			requestor.getResults());
6672
}
6787
}
6673
public void testCompletionKeywordWhile10() throws JavaModelException {
6788
public void testCompletionKeywordTry5() throws JavaModelException {
6674
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6789
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6675
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile10.java");
6790
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry5.java");
6676
6791
6677
		String str = cu.getSource();
6792
		String str = cu.getSource();
6678
		String completeBehind = "wh";
6793
		String completeBehind = "tr";
6679
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6794
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6680
		cu.codeComplete(cursorLocation, requestor);
6795
		cu.codeComplete(cursorLocation, requestor);
6681
6796
6682
		assertEquals(
6797
		assertEquals(
6683
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6798
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
6684
			requestor.getResults());
6799
			requestor.getResults());
6685
}
6800
}
6686
public void testCompletionKeywordExtends6() throws JavaModelException {
6801
public void testCompletionKeywordTry6() throws JavaModelException {
6687
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6802
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6688
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends6.java");
6803
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTry6.java");
6689
6804
6690
		String str = cu.getSource();
6805
		String str = cu.getSource();
6691
		String completeBehind = "ext";
6806
		String completeBehind = "try";
6692
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6807
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6693
		cu.codeComplete(cursorLocation, requestor);
6808
		cu.codeComplete(cursorLocation, requestor);
6694
6809
6695
		assertEquals(
6810
		assertEquals(
6696
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6811
			"",
6697
			requestor.getResults());
6812
			requestor.getResults());
6698
}
6813
}
6699
public void testCompletionKeywordExtends7() throws JavaModelException {
6814
public void testCompletionKeywordDo4() throws JavaModelException {
6700
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6815
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6701
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends7.java");
6816
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo4.java");
6702
6817
6703
		String str = cu.getSource();
6818
		String str = cu.getSource();
6704
		String completeBehind = "ext";
6819
		String completeBehind = "do";
6705
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6820
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6706
		cu.codeComplete(cursorLocation, requestor);
6821
		cu.codeComplete(cursorLocation, requestor);
6707
6822
6708
		assertEquals(
6823
		assertEquals(
6709
			"",
6824
			"element:do    completion:do    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"\n"+
6825
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6710
			requestor.getResults());
6826
			requestor.getResults());
6711
}
6827
}
6712
public void testCompletionKeywordExtends8() throws JavaModelException {
6828
public void testCompletionKeywordDo5() throws JavaModelException {
6713
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6829
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6714
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends8.java");
6830
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo5.java");
6715
6831
6716
		String str = cu.getSource();
6832
		String str = cu.getSource();
6717
		String completeBehind = "ext";
6833
		String completeBehind = "do";
6718
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6834
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6719
		cu.codeComplete(cursorLocation, requestor);
6835
		cu.codeComplete(cursorLocation, requestor);
6720
6836
6721
		assertEquals(
6837
		assertEquals(
6722
			"",
6838
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6723
			requestor.getResults());
6839
			requestor.getResults());
6724
}
6840
}
6725
public void testCompletionKeywordExtends9() throws JavaModelException {
6841
public void testCompletionKeywordDo6() throws JavaModelException {
6726
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6842
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6727
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends9.java");
6843
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDo6.java");
6728
6844
6729
		String str = cu.getSource();
6845
		String str = cu.getSource();
6730
		String completeBehind = "ext";
6846
		String completeBehind = "do";
6731
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6847
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6732
		cu.codeComplete(cursorLocation, requestor);
6848
		cu.codeComplete(cursorLocation, requestor);
6733
6849
6734
		assertEquals(
6850
		assertEquals(
6735
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6851
			"element:double    completion:double    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6736
			requestor.getResults());
6852
			requestor.getResults());
6737
}
6853
}
6738
public void testCompletionKeywordExtends10() throws JavaModelException {
6854
public void testCompletionKeywordFor4() throws JavaModelException {
6739
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6855
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6740
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends10.java");
6856
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor4.java");
6741
6857
6742
		String str = cu.getSource();
6858
		String str = cu.getSource();
6743
		String completeBehind = "ext";
6859
		String completeBehind = "fo";
6744
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6860
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6745
		cu.codeComplete(cursorLocation, requestor);
6861
		cu.codeComplete(cursorLocation, requestor);
6746
6862
6747
		assertEquals(
6863
		assertEquals(
6748
			"",
6864
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
6865
			"element:for    completion:for    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6749
			requestor.getResults());
6866
			requestor.getResults());
6750
}
6867
}
6751
public void testCompletionKeywordImplements4() throws JavaModelException {
6868
public void testCompletionKeywordFor5() throws JavaModelException {
6752
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6869
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6753
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements4.java");
6870
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor5.java");
6754
6871
6755
		String str = cu.getSource();
6872
		String str = cu.getSource();
6756
		String completeBehind = "imp";
6873
		String completeBehind = "fo";
6757
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6874
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6758
		cu.codeComplete(cursorLocation, requestor);
6875
		cu.codeComplete(cursorLocation, requestor);
6759
6876
6760
		assertEquals(
6877
		assertEquals(
6761
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6878
			"element:foo    completion:foo()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
6762
			requestor.getResults());
6879
			requestor.getResults());
6763
}
6880
}
6764
public void testCompletionKeywordImplements5() throws JavaModelException {
6881
public void testCompletionKeywordFor6() throws JavaModelException {
6765
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6882
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6766
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements5.java");
6883
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFor6.java");
6767
6884
6768
		String str = cu.getSource();
6885
		String str = cu.getSource();
6769
		String completeBehind = "imp";
6886
		String completeBehind = "fo";
6770
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6887
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6771
		cu.codeComplete(cursorLocation, requestor);
6888
		cu.codeComplete(cursorLocation, requestor);
6772
6889
6773
		assertEquals(
6890
		assertEquals(
6774
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6891
			"",
6775
			requestor.getResults());
6892
			requestor.getResults());
6776
}
6893
}
6777
public void testCompletionKeywordImplements6() throws JavaModelException {
6894
public void testCompletionKeywordIf4() throws JavaModelException {
6778
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6895
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6779
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements6.java");
6896
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf4.java");
6780
6897
6781
		String str = cu.getSource();
6898
		String str = cu.getSource();
6782
		String completeBehind = "imp";
6899
		String completeBehind = "if";
6783
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6900
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6784
		cu.codeComplete(cursorLocation, requestor);
6901
		cu.codeComplete(cursorLocation, requestor);
6785
6902
6786
		assertEquals(
6903
		assertEquals(
6787
			"",
6904
			"element:if    completion:if    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
6788
			requestor.getResults());
6905
			requestor.getResults());
6789
}
6906
}
6790
public void testCompletionKeywordPackage5() throws JavaModelException {
6907
public void testCompletionKeywordIf5() throws JavaModelException {
6791
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6908
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6792
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage5.java");
6909
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf5.java");
6793
6910
6794
		String str = cu.getSource();
6911
		String str = cu.getSource();
6795
		String completeBehind = "pac";
6912
		String completeBehind = "if";
6796
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6913
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6797
		cu.codeComplete(cursorLocation, requestor);
6914
		cu.codeComplete(cursorLocation, requestor);
6798
6915
Lines 6800-6811 Link Here
6800
			"",
6917
			"",
6801
			requestor.getResults());
6918
			requestor.getResults());
6802
}
6919
}
6803
public void testCompletionKeywordPackage6() throws JavaModelException {
6920
public void testCompletionKeywordIf6() throws JavaModelException {
6804
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6921
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6805
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage6.java");
6922
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordIf6.java");
6806
6923
6807
		String str = cu.getSource();
6924
		String str = cu.getSource();
6808
		String completeBehind = "pac";
6925
		String completeBehind = "if";
6809
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6926
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6810
		cu.codeComplete(cursorLocation, requestor);
6927
		cu.codeComplete(cursorLocation, requestor);
6811
6928
Lines 6813-6837 Link Here
6813
			"",
6930
			"",
6814
			requestor.getResults());
6931
			requestor.getResults());
6815
}
6932
}
6816
public void testCompletionKeywordPackage7() throws JavaModelException {
6933
public void testCompletionKeywordReturn4() throws JavaModelException {
6817
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6934
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6818
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage7.java");
6935
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn4.java");
6819
6936
6820
		String str = cu.getSource();
6937
		String str = cu.getSource();
6821
		String completeBehind = "pac";
6938
		String completeBehind = "re";
6822
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6939
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6823
		cu.codeComplete(cursorLocation, requestor);
6940
		cu.codeComplete(cursorLocation, requestor);
6824
6941
6825
		assertEquals(
6942
		assertEquals(
6826
			"",
6943
			"element:return    completion:return    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6827
			requestor.getResults());
6944
			requestor.getResults());
6828
}
6945
}
6829
public void testCompletionKeywordPackage8() throws JavaModelException {
6946
public void testCompletionKeywordReturn5() throws JavaModelException {
6830
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6947
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6831
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage8.java");
6948
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn5.java");
6832
6949
6833
		String str = cu.getSource();
6950
		String str = cu.getSource();
6834
		String completeBehind = "pac";
6951
		String completeBehind = "re";
6835
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6952
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6836
		cu.codeComplete(cursorLocation, requestor);
6953
		cu.codeComplete(cursorLocation, requestor);
6837
6954
Lines 6839-6954 Link Here
6839
			"",
6956
			"",
6840
			requestor.getResults());
6957
			requestor.getResults());
6841
}
6958
}
6842
public void testCompletionKeywordImport5() throws JavaModelException {
6959
public void testCompletionKeywordReturn6() throws JavaModelException {
6843
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6960
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6844
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport5.java");
6961
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordReturn6.java");
6845
6962
6846
		String str = cu.getSource();
6963
		String str = cu.getSource();
6847
		String completeBehind = "imp";
6964
		String completeBehind = "re";
6848
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6965
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6849
		cu.codeComplete(cursorLocation, requestor);
6966
		cu.codeComplete(cursorLocation, requestor);
6850
6967
6851
		assertEquals(
6968
		assertEquals(
6852
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6969
			"",
6853
			requestor.getResults());
6970
			requestor.getResults());
6854
}
6971
}
6855
public void testCompletionKeywordImport6() throws JavaModelException {
6972
public void testCompletionKeywordSwitch4() throws JavaModelException {
6856
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6973
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6857
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport6.java");
6974
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch4.java");
6858
6975
6859
		String str = cu.getSource();
6976
		String str = cu.getSource();
6860
		String completeBehind = "imp";
6977
		String completeBehind = "sw";
6861
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6978
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6862
		cu.codeComplete(cursorLocation, requestor);
6979
		cu.codeComplete(cursorLocation, requestor);
6863
6980
6864
		assertEquals(
6981
		assertEquals(
6865
			"",
6982
			"element:switch    completion:switch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6866
			requestor.getResults());
6983
			requestor.getResults());
6867
}
6984
}
6868
public void testCompletionKeywordImport7() throws JavaModelException {
6985
public void testCompletionKeywordSwitch5() throws JavaModelException {
6869
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6986
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6870
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport7.java");
6987
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch5.java");
6871
6988
6872
		String str = cu.getSource();
6989
		String str = cu.getSource();
6873
		String completeBehind = "imp";
6990
		String completeBehind = "sw";
6874
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6991
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6875
		cu.codeComplete(cursorLocation, requestor);
6992
		cu.codeComplete(cursorLocation, requestor);
6876
6993
6877
		assertEquals(
6994
		assertEquals(
6878
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6995
			"",
6879
			requestor.getResults());
6996
			requestor.getResults());
6880
}
6997
}
6881
public void testCompletionKeywordImport8() throws JavaModelException {
6998
public void testCompletionKeywordSwitch6() throws JavaModelException {
6882
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6999
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6883
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport8.java");
7000
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSwitch6.java");
6884
7001
6885
		String str = cu.getSource();
7002
		String str = cu.getSource();
6886
		String completeBehind = "imp";
7003
		String completeBehind = "sw";
6887
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7004
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6888
		cu.codeComplete(cursorLocation, requestor);
7005
		cu.codeComplete(cursorLocation, requestor);
6889
7006
6890
		assertEquals(
7007
		assertEquals(
6891
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7008
			"",
6892
			requestor.getResults());
7009
			requestor.getResults());
6893
}
7010
}
6894
public void testCompletionKeywordCase6() throws JavaModelException {
7011
public void testCompletionKeywordThrow4() throws JavaModelException {
6895
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7012
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6896
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase6.java");
7013
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow4.java");
6897
7014
6898
		String str = cu.getSource();
7015
		String str = cu.getSource();
6899
		String completeBehind = "cas";
7016
		String completeBehind = "thr";
6900
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7017
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6901
		cu.codeComplete(cursorLocation, requestor);
7018
		cu.codeComplete(cursorLocation, requestor);
6902
7019
6903
		assertEquals(
7020
		assertEquals(
6904
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7021
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7022
			"element:throw    completion:throw    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6905
			requestor.getResults());
7023
			requestor.getResults());
6906
}
7024
}
6907
public void testCompletionKeywordCase7() throws JavaModelException {
7025
public void testCompletionKeywordThrow5() throws JavaModelException {
6908
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7026
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6909
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase7.java");
7027
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow5.java");
6910
7028
6911
		String str = cu.getSource();
7029
		String str = cu.getSource();
6912
		String completeBehind = "cas";
7030
		String completeBehind = "thr";
6913
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7031
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6914
		cu.codeComplete(cursorLocation, requestor);
7032
		cu.codeComplete(cursorLocation, requestor);
6915
7033
6916
		assertEquals(
7034
		assertEquals(
6917
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7035
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6918
			requestor.getResults());
7036
			requestor.getResults());
6919
}
7037
}
6920
public void testCompletionKeywordCase8() throws JavaModelException {
7038
public void testCompletionKeywordThrow6() throws JavaModelException {
6921
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7039
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6922
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase8.java");
7040
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrow6.java");
6923
7041
6924
		String str = cu.getSource();
7042
		String str = cu.getSource();
6925
		String completeBehind = "cas";
7043
		String completeBehind = "thr";
6926
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7044
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6927
		cu.codeComplete(cursorLocation, requestor);
7045
		cu.codeComplete(cursorLocation, requestor);
6928
7046
6929
		assertEquals(
7047
		assertEquals(
6930
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7048
			"element:Throwable    completion:Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
6931
			requestor.getResults());
7049
			requestor.getResults());
6932
}
7050
}
6933
public void testCompletionKeywordCase9() throws JavaModelException {
7051
public void testCompletionKeywordAssert4() throws JavaModelException {
6934
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7052
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6935
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase9.java");
7053
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert4.java");
6936
7054
6937
		String str = cu.getSource();
7055
		String str = cu.getSource();
6938
		String completeBehind = "cas";
7056
		String completeBehind = "as";
6939
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7057
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6940
		cu.codeComplete(cursorLocation, requestor);
7058
		cu.codeComplete(cursorLocation, requestor);
6941
7059
6942
		assertEquals(
7060
		assertEquals(
6943
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7061
			"element:assert    completion:assert    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6944
			requestor.getResults());
7062
			requestor.getResults());
6945
}
7063
}
6946
public void testCompletionKeywordCase10() throws JavaModelException {
7064
public void testCompletionKeywordAssert5() throws JavaModelException {
6947
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7065
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6948
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase10.java");
7066
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert5.java");
6949
7067
6950
		String str = cu.getSource();
7068
		String str = cu.getSource();
6951
		String completeBehind = "cas";
7069
		String completeBehind = "as";
6952
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7070
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6953
		cu.codeComplete(cursorLocation, requestor);
7071
		cu.codeComplete(cursorLocation, requestor);
6954
7072
Lines 6956-7386 Link Here
6956
			"",
7074
			"",
6957
			requestor.getResults());
7075
			requestor.getResults());
6958
}
7076
}
6959
public void testCompletionKeywordDefault6() throws JavaModelException {
7077
public void testCompletionKeywordAssert6() throws JavaModelException {
6960
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7078
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6961
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault6.java");
7079
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAssert6.java");
6962
7080
6963
		String str = cu.getSource();
7081
		String str = cu.getSource();
6964
		String completeBehind = "def";
7082
		String completeBehind = "as";
6965
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7083
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6966
		cu.codeComplete(cursorLocation, requestor);
7084
		cu.codeComplete(cursorLocation, requestor);
6967
7085
6968
		assertEquals(
7086
		assertEquals(
6969
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7087
			"",
6970
			requestor.getResults());
7088
			requestor.getResults());
6971
}
7089
}
6972
public void testCompletionKeywordDefault7() throws JavaModelException {
7090
public void testCompletionKeywordElse5() throws JavaModelException {
6973
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7091
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6974
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault7.java");
7092
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse5.java");
6975
7093
6976
		String str = cu.getSource();
7094
		String str = cu.getSource();
6977
		String completeBehind = "def";
7095
		String completeBehind = "els";
6978
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7096
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6979
		cu.codeComplete(cursorLocation, requestor);
7097
		cu.codeComplete(cursorLocation, requestor);
6980
7098
6981
		assertEquals(
7099
		assertEquals(
6982
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7100
			"element:else    completion:else    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6983
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6984
			requestor.getResults());
7101
			requestor.getResults());
6985
}
7102
}
6986
public void testCompletionKeywordDefault8() throws JavaModelException {
7103
public void testCompletionKeywordElse6() throws JavaModelException {
6987
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7104
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
6988
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault8.java");
7105
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse6.java");
6989
7106
6990
		String str = cu.getSource();
7107
		String str = cu.getSource();
6991
		String completeBehind = "def";
7108
		String completeBehind = "els";
6992
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7109
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
6993
		cu.codeComplete(cursorLocation, requestor);
7110
		cu.codeComplete(cursorLocation, requestor);
6994
7111
6995
		assertEquals(
7112
		assertEquals(
6996
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7113
			"",
6997
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
6998
			requestor.getResults());
7114
			requestor.getResults());
6999
}
7115
}
7000
public void testCompletionKeywordDefault9() throws JavaModelException {
7116
public void testCompletionKeywordElse7() throws JavaModelException {
7001
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7117
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7002
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault9.java");
7118
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse7.java");
7003
7119
7004
		String str = cu.getSource();
7120
		String str = cu.getSource();
7005
		String completeBehind = "def";
7121
		String completeBehind = "els";
7006
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7122
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7007
		cu.codeComplete(cursorLocation, requestor);
7123
		cu.codeComplete(cursorLocation, requestor);
7008
7124
7009
		assertEquals(
7125
		assertEquals(
7010
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
7126
			"",
7011
			requestor.getResults());
7127
			requestor.getResults());
7012
}
7128
}
7013
public void testCompletionKeywordDefault10() throws JavaModelException {
7129
public void testCompletionKeywordElse8() throws JavaModelException {
7014
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7130
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7015
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault10.java");
7131
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordElse8.java");
7016
7132
7017
		String str = cu.getSource();
7133
		String str = cu.getSource();
7018
		String completeBehind = "def";
7134
		String completeBehind = "els";
7019
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7135
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7020
		cu.codeComplete(cursorLocation, requestor);
7136
		cu.codeComplete(cursorLocation, requestor);
7021
7137
7022
		assertEquals(
7138
		assertEquals(
7023
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
7139
			"",
7024
			requestor.getResults());
7140
			requestor.getResults());
7025
}
7141
}
7026
public void testCompletionKeywordClass13() throws JavaModelException {
7142
public void testCompletionKeywordCatch6() throws JavaModelException {
7027
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7143
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7028
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass13.java");
7144
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch6.java");
7029
7145
7030
		String str = cu.getSource();
7146
		String str = cu.getSource();
7031
		String completeBehind = "cla";
7147
		String completeBehind = "cat";
7032
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7148
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7033
		cu.codeComplete(cursorLocation, requestor);
7149
		cu.codeComplete(cursorLocation, requestor);
7034
7150
7035
		assertEquals(
7151
		assertEquals(
7036
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7152
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7037
			requestor.getResults());
7153
			requestor.getResults());
7038
}
7154
}
7039
public void testCompletionKeywordClass14() throws JavaModelException {
7155
public void testCompletionKeywordCatch7() throws JavaModelException {
7040
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7156
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7041
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass14.java");
7157
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch7.java");
7042
7158
7043
		String str = cu.getSource();
7159
		String str = cu.getSource();
7044
		String completeBehind = "cla";
7160
		String completeBehind = "cat";
7045
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7161
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7046
		cu.codeComplete(cursorLocation, requestor);
7162
		cu.codeComplete(cursorLocation, requestor);
7047
7163
7048
		assertEquals(
7164
		assertEquals(
7049
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7165
			"",
7050
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7051
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7052
			requestor.getResults());
7166
			requestor.getResults());
7053
}
7167
}
7054
public void testCompletionKeywordClass15() throws JavaModelException {
7168
public void testCompletionKeywordCatch8() throws JavaModelException {
7055
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7169
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7056
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass15.java");
7170
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch8.java");
7057
7171
7058
		String str = cu.getSource();
7172
		String str = cu.getSource();
7059
		String completeBehind = "cla";
7173
		String completeBehind = "cat";
7060
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7174
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7061
		cu.codeComplete(cursorLocation, requestor);
7175
		cu.codeComplete(cursorLocation, requestor);
7062
7176
7063
		assertEquals(
7177
		assertEquals(
7064
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7178
			"",
7065
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7066
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7067
			requestor.getResults());
7179
			requestor.getResults());
7068
}
7180
}
7069
public void testCompletionKeywordClass16() throws JavaModelException {
7181
public void testCompletionKeywordCatch9() throws JavaModelException {
7070
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7182
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7071
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass16.java");
7183
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch9.java");
7072
7184
7073
		String str = cu.getSource();
7185
		String str = cu.getSource();
7074
		String completeBehind = "cla";
7186
		String completeBehind = "cat";
7075
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7187
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7076
		cu.codeComplete(cursorLocation, requestor);
7188
		cu.codeComplete(cursorLocation, requestor);
7077
7189
7078
		assertEquals(
7190
		assertEquals(
7079
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7191
			"",
7080
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7081
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7082
			requestor.getResults());
7192
			requestor.getResults());
7083
}
7193
}
7084
public void testCompletionKeywordClass17() throws JavaModelException {
7194
public void testCompletionKeywordCatch10() throws JavaModelException {
7085
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7195
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7086
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass17.java");
7196
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCatch10.java");
7087
7197
7088
		String str = cu.getSource();
7198
		String str = cu.getSource();
7089
		String completeBehind = "cla";
7199
		String completeBehind = "cat";
7090
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7200
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7091
		cu.codeComplete(cursorLocation, requestor);
7201
		cu.codeComplete(cursorLocation, requestor);
7092
7202
7093
		assertEquals(
7203
		assertEquals(
7094
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7204
			"element:catch    completion:catch    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
7205
			"element:catchz    completion:catchz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
7095
			requestor.getResults());
7206
			requestor.getResults());
7096
}
7207
}
7097
public void testCompletionKeywordClass18() throws JavaModelException {
7208
public void testCompletionKeywordFinally8() throws JavaModelException {
7098
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7209
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7099
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass18.java");
7210
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally8.java");
7100
7211
7101
		String str = cu.getSource();
7212
		String str = cu.getSource();
7102
		String completeBehind = "cla";
7213
		String completeBehind = "finall";
7103
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7214
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7104
		cu.codeComplete(cursorLocation, requestor);
7215
		cu.codeComplete(cursorLocation, requestor);
7105
7216
7106
		assertEquals(
7217
		assertEquals(
7107
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7218
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7108
			requestor.getResults());
7219
			requestor.getResults());
7109
}
7220
}
7110
public void testCompletionKeywordClass19() throws JavaModelException {
7221
public void testCompletionKeywordFinally9() throws JavaModelException {
7111
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7222
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7112
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass19.java");
7223
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally9.java");
7113
7224
7114
		String str = cu.getSource();
7225
		String str = cu.getSource();
7115
		String completeBehind = "cla";
7226
		String completeBehind = "finall";
7116
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7227
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7117
		cu.codeComplete(cursorLocation, requestor);
7228
		cu.codeComplete(cursorLocation, requestor);
7118
7229
7119
		assertEquals(
7230
		assertEquals(
7120
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7231
			"",
7121
			requestor.getResults());
7232
			requestor.getResults());
7122
}
7233
}
7123
public void testCompletionKeywordClass20() throws JavaModelException {
7234
public void testCompletionKeywordFinally10() throws JavaModelException {
7124
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7235
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7125
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass20.java");
7236
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally10.java");
7126
7237
7127
		String str = cu.getSource();
7238
		String str = cu.getSource();
7128
		String completeBehind = "cla";
7239
		String completeBehind = "finall";
7129
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7240
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7130
		cu.codeComplete(cursorLocation, requestor);
7241
		cu.codeComplete(cursorLocation, requestor);
7131
7242
7132
		assertEquals(
7243
		assertEquals(
7133
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7244
			"",
7134
			requestor.getResults());
7245
			requestor.getResults());
7135
}
7246
}
7136
public void testCompletionKeywordClass21() throws JavaModelException {
7247
public void testCompletionKeywordFinally11() throws JavaModelException {
7137
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7248
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7138
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass21.java");
7249
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally11.java");
7139
7250
7140
		String str = cu.getSource();
7251
		String str = cu.getSource();
7141
		String completeBehind = "cla";
7252
		String completeBehind = "finall";
7142
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7253
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7143
		cu.codeComplete(cursorLocation, requestor);
7254
		cu.codeComplete(cursorLocation, requestor);
7144
7255
7145
		assertEquals(
7256
		assertEquals(
7146
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7257
			"",
7147
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7148
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7149
			requestor.getResults());
7258
			requestor.getResults());
7150
}
7259
}
7151
public void testCompletionKeywordClass22() throws JavaModelException {
7260
public void testCompletionKeywordFinally12() throws JavaModelException {
7152
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7261
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7153
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass22.java");
7262
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally12.java");
7154
7263
7155
		String str = cu.getSource();
7264
		String str = cu.getSource();
7156
		String completeBehind = "cla";
7265
		String completeBehind = "finall";
7157
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7266
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7158
		cu.codeComplete(cursorLocation, requestor);
7267
		cu.codeComplete(cursorLocation, requestor);
7159
7268
7160
		assertEquals(
7269
		assertEquals(
7161
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7270
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7162
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7163
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7164
			requestor.getResults());
7271
			requestor.getResults());
7165
}
7272
}
7166
public void testCompletionKeywordClass23() throws JavaModelException {
7273
public void testCompletionKeywordFinally13() throws JavaModelException {
7167
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7274
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7168
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass23.java");
7275
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally13.java");
7169
7276
7170
		String str = cu.getSource();
7277
		String str = cu.getSource();
7171
		String completeBehind = "cla";
7278
		String completeBehind = "finall";
7172
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7279
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7173
		cu.codeComplete(cursorLocation, requestor);
7280
		cu.codeComplete(cursorLocation, requestor);
7174
7281
7175
		assertEquals(
7282
		assertEquals(
7176
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7283
			"element:finally    completion:finally    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
7177
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7284
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
7178
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7179
			requestor.getResults());
7285
			requestor.getResults());
7180
}
7286
}
7181
public void testCompletionKeywordClass24() throws JavaModelException {
7287
public void testCompletionKeywordFinally14() throws JavaModelException {
7182
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7288
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7183
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass24.java");
7289
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinally14.java");
7184
7290
7185
		String str = cu.getSource();
7291
		String str = cu.getSource();
7186
		String completeBehind = "cla";
7292
		String completeBehind = "finall";
7187
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7293
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7188
		cu.codeComplete(cursorLocation, requestor);
7294
		cu.codeComplete(cursorLocation, requestor);
7189
7295
7190
		assertEquals(
7296
		assertEquals(
7191
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7297
			"element:finallyz    completion:finallyz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
7192
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7193
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7194
			requestor.getResults());
7298
			requestor.getResults());
7195
}
7299
}
7196
public void testCompletionKeywordInterface10() throws JavaModelException {
7300
public void testCompletionKeywordContinue3() throws JavaModelException {
7197
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7301
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7198
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
7302
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue3.java");
7199
7303
7200
		String str = cu.getSource();
7304
		String str = cu.getSource();
7201
		String completeBehind = "interf";
7305
		String completeBehind = "cont";
7202
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7306
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7203
		cu.codeComplete(cursorLocation, requestor);
7307
		cu.codeComplete(cursorLocation, requestor);
7204
7308
7205
		assertEquals(
7309
		assertEquals(
7206
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7310
			"element:continue    completion:continue    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7207
			requestor.getResults());
7311
			requestor.getResults());
7208
}
7312
}
7209
public void testCompletionKeywordInterface11() throws JavaModelException {
7313
public void testCompletionKeywordContinue4() throws JavaModelException {
7210
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7314
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7211
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface11.java");
7315
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordContinue4.java");
7212
7316
7213
		String str = cu.getSource();
7317
		String str = cu.getSource();
7214
		String completeBehind = "interf";
7318
		String completeBehind = "cont";
7215
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7319
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7216
		cu.codeComplete(cursorLocation, requestor);
7320
		cu.codeComplete(cursorLocation, requestor);
7217
7321
7218
		assertEquals(
7322
		assertEquals(
7219
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7323
			"",
7220
			requestor.getResults());
7324
			requestor.getResults());
7221
}
7325
}
7222
public void testCompletionKeywordInterface12() throws JavaModelException {
7326
public void testCompletionKeywordBreak4() throws JavaModelException {
7223
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7327
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7224
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface12.java");
7328
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak4.java");
7225
7329
7226
		String str = cu.getSource();
7330
		String str = cu.getSource();
7227
		String completeBehind = "interf";
7331
		String completeBehind = "bre";
7228
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7332
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7229
		cu.codeComplete(cursorLocation, requestor);
7333
		cu.codeComplete(cursorLocation, requestor);
7230
7334
7231
		assertEquals(
7335
		assertEquals(
7232
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7336
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7233
			requestor.getResults());
7337
			requestor.getResults());
7234
}
7338
}
7235
public void testCompletionKeywordInterface13() throws JavaModelException {
7339
public void testCompletionKeywordBreak5() throws JavaModelException {
7236
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7340
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7237
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface13.java");
7341
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak5.java");
7238
7342
7239
		String str = cu.getSource();
7343
		String str = cu.getSource();
7240
		String completeBehind = "interf";
7344
		String completeBehind = "bre";
7241
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7345
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7242
		cu.codeComplete(cursorLocation, requestor);
7346
		cu.codeComplete(cursorLocation, requestor);
7243
7347
7244
		assertEquals(
7348
		assertEquals(
7245
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7349
			"",
7246
			requestor.getResults());
7350
			requestor.getResults());
7247
}
7351
}
7248
public void testCompletionKeywordInterface14() throws JavaModelException {
7352
public void testCompletionKeywordBreak6() throws JavaModelException {
7249
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7353
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7250
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface14.java");
7354
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordBreak6.java");
7251
7355
7252
		String str = cu.getSource();
7356
		String str = cu.getSource();
7253
		String completeBehind = "interf";
7357
		String completeBehind = "bre";
7254
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7358
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7255
		cu.codeComplete(cursorLocation, requestor);
7359
		cu.codeComplete(cursorLocation, requestor);
7256
7360
7257
		assertEquals(
7361
		assertEquals(
7258
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7362
			"element:break    completion:break    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7259
			requestor.getResults());
7363
			requestor.getResults());
7260
}
7364
}
7261
public void testCompletionKeywordInterface15() throws JavaModelException {
7365
public void testCompletionKeywordWhile6() throws JavaModelException {
7262
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7366
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7263
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface15.java");
7367
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile6.java");
7264
7368
7265
		String str = cu.getSource();
7369
		String str = cu.getSource();
7266
		String completeBehind = "interf";
7370
		String completeBehind = "wh";
7267
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7371
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7268
		cu.codeComplete(cursorLocation, requestor);
7372
		cu.codeComplete(cursorLocation, requestor);
7269
7373
7270
		assertEquals(
7374
		assertEquals(
7271
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7375
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7272
			requestor.getResults());
7376
			requestor.getResults());
7273
}
7377
}
7274
public void testCompletionKeywordInterface16() throws JavaModelException {
7378
public void testCompletionKeywordWhile7() throws JavaModelException {
7275
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7379
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7276
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface16.java");
7380
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile7.java");
7277
7381
7278
		String str = cu.getSource();
7382
		String str = cu.getSource();
7279
		String completeBehind = "interf";
7383
		String completeBehind = "wh";
7280
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7384
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7281
		cu.codeComplete(cursorLocation, requestor);
7385
		cu.codeComplete(cursorLocation, requestor);
7282
7386
7283
		assertEquals(
7387
		assertEquals(
7284
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7388
			"",
7285
			requestor.getResults());
7389
			requestor.getResults());
7286
}
7390
}
7287
public void testCompletionKeywordInterface17() throws JavaModelException {
7391
public void testCompletionKeywordWhile8() throws JavaModelException {
7288
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7392
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7289
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface17.java");
7393
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile8.java");
7290
7394
7291
		String str = cu.getSource();
7395
		String str = cu.getSource();
7292
		String completeBehind = "interf";
7396
		String completeBehind = "wh";
7293
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7397
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7294
		cu.codeComplete(cursorLocation, requestor);
7398
		cu.codeComplete(cursorLocation, requestor);
7295
7399
7296
		assertEquals(
7400
		assertEquals(
7297
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7401
			"",
7298
			requestor.getResults());
7402
			requestor.getResults());
7299
}
7403
}
7300
public void testCompletionKeywordInterface18() throws JavaModelException {
7404
public void testCompletionKeywordWhile9() throws JavaModelException {
7301
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7405
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7302
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface18.java");
7406
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile9.java");
7303
7407
7304
		String str = cu.getSource();
7408
		String str = cu.getSource();
7305
		String completeBehind = "interf";
7409
		String completeBehind = "wh";
7306
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7410
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7307
		cu.codeComplete(cursorLocation, requestor);
7411
		cu.codeComplete(cursorLocation, requestor);
7308
7412
7309
		assertEquals(
7413
		assertEquals(
7310
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7414
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7311
			requestor.getResults());
7415
			requestor.getResults());
7312
}
7416
}
7313
public void testCompletionKeywordThrows5() throws JavaModelException {
7417
public void testCompletionKeywordWhile10() throws JavaModelException {
7314
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7418
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7315
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows5.java");
7419
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordWhile10.java");
7316
7420
7317
		String str = cu.getSource();
7421
		String str = cu.getSource();
7318
		String completeBehind = "thro";
7422
		String completeBehind = "wh";
7319
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7423
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7320
		cu.codeComplete(cursorLocation, requestor);
7424
		cu.codeComplete(cursorLocation, requestor);
7321
7425
7322
		assertEquals(
7426
		assertEquals(
7323
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7427
			"element:while    completion:while    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7324
			requestor.getResults());
7428
			requestor.getResults());
7325
}
7429
}
7326
public void testCompletionKeywordThrows6() throws JavaModelException {
7430
public void testCompletionKeywordExtends6() throws JavaModelException {
7327
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7431
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7328
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows6.java");
7432
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends6.java");
7329
7433
7330
		String str = cu.getSource();
7434
		String str = cu.getSource();
7331
		String completeBehind = "thro";
7435
		String completeBehind = "ext";
7332
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7436
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7333
		cu.codeComplete(cursorLocation, requestor);
7437
		cu.codeComplete(cursorLocation, requestor);
7334
7438
7335
		assertEquals(
7439
		assertEquals(
7336
			"",
7440
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7337
			requestor.getResults());
7441
			requestor.getResults());
7338
}
7442
}
7339
public void testCompletionKeywordThrows7() throws JavaModelException {
7443
public void testCompletionKeywordExtends7() throws JavaModelException {
7340
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7444
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7341
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows7.java");
7445
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends7.java");
7342
7446
7343
		String str = cu.getSource();
7447
		String str = cu.getSource();
7344
		String completeBehind = "thro";
7448
		String completeBehind = "ext";
7345
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7449
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7346
		cu.codeComplete(cursorLocation, requestor);
7450
		cu.codeComplete(cursorLocation, requestor);
7347
7451
7348
		assertEquals(
7452
		assertEquals(
7349
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7453
			"",
7350
			requestor.getResults());
7454
			requestor.getResults());
7351
}
7455
}
7352
public void testCompletionKeywordThrows8() throws JavaModelException {
7456
public void testCompletionKeywordExtends8() throws JavaModelException {
7353
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7457
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7354
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows8.java");
7458
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends8.java");
7355
7459
7356
		String str = cu.getSource();
7460
		String str = cu.getSource();
7357
		String completeBehind = "thro";
7461
		String completeBehind = "ext";
7358
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7462
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7359
		cu.codeComplete(cursorLocation, requestor);
7463
		cu.codeComplete(cursorLocation, requestor);
7360
7464
7361
		assertEquals(
7465
		assertEquals(
7362
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7466
			"",
7363
			requestor.getResults());
7467
			requestor.getResults());
7364
}
7468
}
7365
public void testCompletionKeywordSynchronized7() throws JavaModelException {
7469
public void testCompletionKeywordExtends9() throws JavaModelException {
7366
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7470
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7367
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized7.java");
7471
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends9.java");
7368
7472
7369
		String str = cu.getSource();
7473
		String str = cu.getSource();
7370
		String completeBehind = "syn";
7474
		String completeBehind = "ext";
7371
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7475
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7372
		cu.codeComplete(cursorLocation, requestor);
7476
		cu.codeComplete(cursorLocation, requestor);
7373
7477
7374
		assertEquals(
7478
		assertEquals(
7375
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7479
			"element:extends    completion:extends    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7376
			requestor.getResults());
7480
			requestor.getResults());
7377
}
7481
}
7378
public void testCompletionKeywordSynchronized8() throws JavaModelException {
7482
public void testCompletionKeywordExtends10() throws JavaModelException {
7379
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7483
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7380
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized8.java");
7484
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordExtends10.java");
7381
7485
7382
		String str = cu.getSource();
7486
		String str = cu.getSource();
7383
		String completeBehind = "syn";
7487
		String completeBehind = "ext";
7384
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7488
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7385
		cu.codeComplete(cursorLocation, requestor);
7489
		cu.codeComplete(cursorLocation, requestor);
7386
7490
Lines 7388-7438 Link Here
7388
			"",
7492
			"",
7389
			requestor.getResults());
7493
			requestor.getResults());
7390
}
7494
}
7391
public void testCompletionKeywordSynchronized9() throws JavaModelException {
7495
public void testCompletionKeywordImplements4() throws JavaModelException {
7392
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7496
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7393
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized9.java");
7497
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements4.java");
7394
7498
7395
		String str = cu.getSource();
7499
		String str = cu.getSource();
7396
		String completeBehind = "syn";
7500
		String completeBehind = "imp";
7397
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7501
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7398
		cu.codeComplete(cursorLocation, requestor);
7502
		cu.codeComplete(cursorLocation, requestor);
7399
7503
7400
		assertEquals(
7504
		assertEquals(
7401
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7505
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7402
			requestor.getResults());
7506
			requestor.getResults());
7403
}
7507
}
7404
public void testCompletionKeywordSynchronized10() throws JavaModelException {
7508
public void testCompletionKeywordImplements5() throws JavaModelException {
7405
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7509
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7406
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized10.java");
7510
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements5.java");
7407
7511
7408
		String str = cu.getSource();
7512
		String str = cu.getSource();
7409
		String completeBehind = "syn";
7513
		String completeBehind = "imp";
7410
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7514
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7411
		cu.codeComplete(cursorLocation, requestor);
7515
		cu.codeComplete(cursorLocation, requestor);
7412
7516
7413
		assertEquals(
7517
		assertEquals(
7414
			"",
7518
			"element:implements    completion:implements    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7415
			requestor.getResults());
7519
			requestor.getResults());
7416
}
7520
}
7417
public void testCompletionKeywordSynchronized11() throws JavaModelException {
7521
public void testCompletionKeywordImplements6() throws JavaModelException {
7418
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7522
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7419
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized11.java");
7523
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImplements6.java");
7420
7524
7421
		String str = cu.getSource();
7525
		String str = cu.getSource();
7422
		String completeBehind = "syn";
7526
		String completeBehind = "imp";
7423
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7527
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7424
		cu.codeComplete(cursorLocation, requestor);
7528
		cu.codeComplete(cursorLocation, requestor);
7425
7529
7426
		assertEquals(
7530
		assertEquals(
7427
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7531
			"",
7428
			requestor.getResults());
7532
			requestor.getResults());
7429
}
7533
}
7430
public void testCompletionKeywordSynchronized12() throws JavaModelException {
7534
public void testCompletionKeywordPackage5() throws JavaModelException {
7431
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7535
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7432
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized12.java");
7536
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage5.java");
7433
7537
7434
		String str = cu.getSource();
7538
		String str = cu.getSource();
7435
		String completeBehind = "syn";
7539
		String completeBehind = "pac";
7436
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7540
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7437
		cu.codeComplete(cursorLocation, requestor);
7541
		cu.codeComplete(cursorLocation, requestor);
7438
7542
Lines 7440-7464 Link Here
7440
			"",
7544
			"",
7441
			requestor.getResults());
7545
			requestor.getResults());
7442
}
7546
}
7443
public void testCompletionKeywordNative5() throws JavaModelException {
7547
public void testCompletionKeywordPackage6() throws JavaModelException {
7444
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7548
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7445
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative5.java");
7549
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage6.java");
7446
7550
7447
		String str = cu.getSource();
7551
		String str = cu.getSource();
7448
		String completeBehind = "nat";
7552
		String completeBehind = "pac";
7449
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7553
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7450
		cu.codeComplete(cursorLocation, requestor);
7554
		cu.codeComplete(cursorLocation, requestor);
7451
7555
7452
		assertEquals(
7556
		assertEquals(
7453
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7557
			"",
7454
			requestor.getResults());
7558
			requestor.getResults());
7455
}
7559
}
7456
public void testCompletionKeywordNative6() throws JavaModelException {
7560
public void testCompletionKeywordPackage7() throws JavaModelException {
7457
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7561
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7458
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative6.java");
7562
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPackage7.java");
7459
7563
7460
		String str = cu.getSource();
7564
		String str = cu.getSource();
7461
		String completeBehind = "nat";
7565
		String completeBehind = "pac";
7462
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7566
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7463
		cu.codeComplete(cursorLocation, requestor);
7567
		cu.codeComplete(cursorLocation, requestor);
7464
7568
Lines 7466-7594 Link Here
7466
			"",
7570
			"",
7467
			requestor.getResults());
7571
			requestor.getResults());
7468
}
7572
}
7469
public void testCompletionKeywordNative7() throws JavaModelException {
7573
public void testCompletionKeywordPackage8() throws JavaModelException {
7470
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7574
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7471
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative7.java");
7575
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordPackage8.java");
7472
7576
7473
		String str = cu.getSource();
7577
		String str = cu.getSource();
7474
		String completeBehind = "nat";
7578
		String completeBehind = "pac";
7475
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7579
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7476
		cu.codeComplete(cursorLocation, requestor);
7580
		cu.codeComplete(cursorLocation, requestor);
7477
7581
7478
		assertEquals(
7582
		assertEquals(
7479
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7583
			"",
7480
			requestor.getResults());
7584
			requestor.getResults());
7481
}
7585
}
7482
public void testCompletionKeywordNative8() throws JavaModelException {
7586
public void testCompletionKeywordImport5() throws JavaModelException {
7483
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7587
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7484
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative8.java");
7588
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport5.java");
7485
7589
7486
		String str = cu.getSource();
7590
		String str = cu.getSource();
7487
		String completeBehind = "nat";
7591
		String completeBehind = "imp";
7488
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7592
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7489
		cu.codeComplete(cursorLocation, requestor);
7593
		cu.codeComplete(cursorLocation, requestor);
7490
7594
7491
		assertEquals(
7595
		assertEquals(
7492
			"",
7596
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7493
			requestor.getResults());
7597
			requestor.getResults());
7494
}
7598
}
7495
public void testCompletionKeywordStrictfp5() throws JavaModelException {
7599
public void testCompletionKeywordImport6() throws JavaModelException {
7496
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7600
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7497
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp5.java");
7601
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport6.java");
7498
7602
7499
		String str = cu.getSource();
7603
		String str = cu.getSource();
7500
		String completeBehind = "stric";
7604
		String completeBehind = "imp";
7501
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7605
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7502
		cu.codeComplete(cursorLocation, requestor);
7606
		cu.codeComplete(cursorLocation, requestor);
7503
7607
7504
		assertEquals(
7608
		assertEquals(
7505
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7609
			"",
7506
			requestor.getResults());
7610
			requestor.getResults());
7507
}
7611
}
7508
public void testCompletionKeywordStrictfp6() throws JavaModelException {
7612
public void testCompletionKeywordImport7() throws JavaModelException {
7509
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7613
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7510
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp6.java");
7614
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordImport7.java");
7511
7615
7512
		String str = cu.getSource();
7616
		String str = cu.getSource();
7513
		String completeBehind = "stric";
7617
		String completeBehind = "imp";
7514
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7618
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7515
		cu.codeComplete(cursorLocation, requestor);
7619
		cu.codeComplete(cursorLocation, requestor);
7516
7620
7517
		assertEquals(
7621
		assertEquals(
7518
			"",
7622
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7519
			requestor.getResults());
7623
			requestor.getResults());
7520
}
7624
}
7521
public void testCompletionKeywordStrictfp7() throws JavaModelException {
7625
public void testCompletionKeywordImport8() throws JavaModelException {
7522
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7626
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7523
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp7.java");
7627
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "p", "CompletionKeywordImport8.java");
7524
7628
7525
		String str = cu.getSource();
7629
		String str = cu.getSource();
7526
		String completeBehind = "stric";
7630
		String completeBehind = "imp";
7527
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7631
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7528
		cu.codeComplete(cursorLocation, requestor);
7632
		cu.codeComplete(cursorLocation, requestor);
7529
7633
7530
		assertEquals(
7634
		assertEquals(
7531
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7635
			"element:import    completion:import    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7532
			requestor.getResults());
7636
			requestor.getResults());
7533
}
7637
}
7534
public void testCompletionKeywordStrictfp8() throws JavaModelException {
7638
public void testCompletionKeywordCase6() throws JavaModelException {
7535
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7639
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7536
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp8.java");
7640
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase6.java");
7537
7641
7538
		String str = cu.getSource();
7642
		String str = cu.getSource();
7539
		String completeBehind = "stric";
7643
		String completeBehind = "cas";
7540
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7644
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7541
		cu.codeComplete(cursorLocation, requestor);
7645
		cu.codeComplete(cursorLocation, requestor);
7542
7646
7543
		assertEquals(
7647
		assertEquals(
7544
			"",
7648
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7545
			requestor.getResults());
7649
			requestor.getResults());
7546
}
7650
}
7547
public void testCompletionKeywordVolatile5() throws JavaModelException {
7651
public void testCompletionKeywordCase7() throws JavaModelException {
7548
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7652
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7549
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile5.java");
7653
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase7.java");
7550
7654
7551
		String str = cu.getSource();
7655
		String str = cu.getSource();
7552
		String completeBehind = "vol";
7656
		String completeBehind = "cas";
7553
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7657
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7554
		cu.codeComplete(cursorLocation, requestor);
7658
		cu.codeComplete(cursorLocation, requestor);
7555
7659
7556
		assertEquals(
7660
		assertEquals(
7557
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7661
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7558
			requestor.getResults());
7662
			requestor.getResults());
7559
}
7663
}
7560
public void testCompletionKeywordVolatile6() throws JavaModelException {
7664
public void testCompletionKeywordCase8() throws JavaModelException {
7561
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7665
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7562
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile6.java");
7666
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase8.java");
7563
7667
7564
		String str = cu.getSource();
7668
		String str = cu.getSource();
7565
		String completeBehind = "vol";
7669
		String completeBehind = "cas";
7566
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7670
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7567
		cu.codeComplete(cursorLocation, requestor);
7671
		cu.codeComplete(cursorLocation, requestor);
7568
7672
7569
		assertEquals(
7673
		assertEquals(
7570
			"",
7674
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7571
			requestor.getResults());
7675
			requestor.getResults());
7572
}
7676
}
7573
public void testCompletionKeywordVolatile7() throws JavaModelException {
7677
public void testCompletionKeywordCase9() throws JavaModelException {
7574
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7678
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7575
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile7.java");
7679
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase9.java");
7576
7680
7577
		String str = cu.getSource();
7681
		String str = cu.getSource();
7578
		String completeBehind = "vol";
7682
		String completeBehind = "cas";
7579
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7683
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7580
		cu.codeComplete(cursorLocation, requestor);
7684
		cu.codeComplete(cursorLocation, requestor);
7581
7685
7582
		assertEquals(
7686
		assertEquals(
7583
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7687
			"element:case    completion:case    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7584
			requestor.getResults());
7688
			requestor.getResults());
7585
}
7689
}
7586
public void testCompletionKeywordVolatile8() throws JavaModelException {
7690
public void testCompletionKeywordCase10() throws JavaModelException {
7587
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7691
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7588
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile8.java");
7692
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordCase10.java");
7589
7693
7590
		String str = cu.getSource();
7694
		String str = cu.getSource();
7591
		String completeBehind = "vol";
7695
		String completeBehind = "cas";
7592
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7696
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7593
		cu.codeComplete(cursorLocation, requestor);
7697
		cu.codeComplete(cursorLocation, requestor);
7594
7698
Lines 7596-8010 Link Here
7596
			"",
7700
			"",
7597
			requestor.getResults());
7701
			requestor.getResults());
7598
}
7702
}
7599
public void testCompletionKeywordTransient5() throws JavaModelException {
7703
public void testCompletionKeywordDefault6() throws JavaModelException {
7600
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7704
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7601
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient5.java");
7705
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault6.java");
7602
7706
7603
		String str = cu.getSource();
7707
		String str = cu.getSource();
7604
		String completeBehind = "tran";
7708
		String completeBehind = "def";
7605
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7709
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7606
		cu.codeComplete(cursorLocation, requestor);
7710
		cu.codeComplete(cursorLocation, requestor);
7607
7711
7608
		assertEquals(
7712
		assertEquals(
7609
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7713
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7610
			requestor.getResults());
7714
			requestor.getResults());
7611
}
7715
}
7612
public void testCompletionKeywordTransient6() throws JavaModelException {
7716
public void testCompletionKeywordDefault7() throws JavaModelException {
7613
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7717
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7614
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient6.java");
7718
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault7.java");
7615
7719
7616
		String str = cu.getSource();
7720
		String str = cu.getSource();
7617
		String completeBehind = "tran";
7721
		String completeBehind = "def";
7618
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7722
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7619
		cu.codeComplete(cursorLocation, requestor);
7723
		cu.codeComplete(cursorLocation, requestor);
7620
7724
7621
		assertEquals(
7725
		assertEquals(
7622
			"",
7726
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7727
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7623
			requestor.getResults());
7728
			requestor.getResults());
7624
}
7729
}
7625
public void testCompletionKeywordTransient7() throws JavaModelException {
7730
public void testCompletionKeywordDefault8() throws JavaModelException {
7626
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7731
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7627
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient7.java");
7732
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault8.java");
7628
7733
7629
		String str = cu.getSource();
7734
		String str = cu.getSource();
7630
		String completeBehind = "tran";
7735
		String completeBehind = "def";
7631
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7736
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7632
		cu.codeComplete(cursorLocation, requestor);
7737
		cu.codeComplete(cursorLocation, requestor);
7633
7738
7634
		assertEquals(
7739
		assertEquals(
7635
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7740
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7741
			"element:default    completion:default    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7636
			requestor.getResults());
7742
			requestor.getResults());
7637
}
7743
}
7638
public void testCompletionKeywordTransient8() throws JavaModelException {
7744
public void testCompletionKeywordDefault9() throws JavaModelException {
7639
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7745
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7640
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient8.java");
7746
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault9.java");
7641
7747
7642
		String str = cu.getSource();
7748
		String str = cu.getSource();
7643
		String completeBehind = "tran";
7749
		String completeBehind = "def";
7644
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7750
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7645
		cu.codeComplete(cursorLocation, requestor);
7751
		cu.codeComplete(cursorLocation, requestor);
7646
7752
7647
		assertEquals(
7753
		assertEquals(
7648
			"",
7754
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
7649
			requestor.getResults());
7755
			requestor.getResults());
7650
}
7756
}
7651
public void testCompletionKeywordNew9() throws JavaModelException {
7757
public void testCompletionKeywordDefault10() throws JavaModelException {
7652
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7758
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7653
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew9.java");
7759
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordDefault10.java");
7654
7760
7655
		String str = cu.getSource();
7761
		String str = cu.getSource();
7656
		String completeBehind = "ne";
7762
		String completeBehind = "def";
7657
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7763
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7658
		cu.codeComplete(cursorLocation, requestor);
7764
		cu.codeComplete(cursorLocation, requestor);
7659
7765
7660
		assertEquals(
7766
		assertEquals(
7661
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7767
			"element:Default    completion:Default    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
7662
			requestor.getResults());
7768
			requestor.getResults());
7663
}
7769
}
7664
public void testCompletionKeywordNew10() throws JavaModelException {
7770
public void testCompletionKeywordClass13() throws JavaModelException {
7665
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7771
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7666
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew10.java");
7772
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass13.java");
7667
7773
7668
		String str = cu.getSource();
7774
		String str = cu.getSource();
7669
		String completeBehind = "ne";
7775
		String completeBehind = "cla";
7670
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7776
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7671
		cu.codeComplete(cursorLocation, requestor);
7777
		cu.codeComplete(cursorLocation, requestor);
7672
7778
7673
		assertEquals(
7779
		assertEquals(
7674
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7780
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7675
			requestor.getResults());
7781
			requestor.getResults());
7676
}
7782
}
7677
public void testCompletionKeywordNew11() throws JavaModelException {
7783
public void testCompletionKeywordClass14() throws JavaModelException {
7678
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7784
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7679
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew11.java");
7785
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass14.java");
7680
7786
7681
		String str = cu.getSource();
7787
		String str = cu.getSource();
7682
		String completeBehind = "ne";
7788
		String completeBehind = "cla";
7683
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7789
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7684
		cu.codeComplete(cursorLocation, requestor);
7790
		cu.codeComplete(cursorLocation, requestor);
7685
7791
7686
		assertEquals(
7792
		assertEquals(
7687
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7793
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7794
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7795
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7688
			requestor.getResults());
7796
			requestor.getResults());
7689
}
7797
}
7690
public void testCompletionKeywordNew12() throws JavaModelException {
7798
public void testCompletionKeywordClass15() throws JavaModelException {
7691
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7799
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7692
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew12.java");
7800
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass15.java");
7693
7801
7694
		String str = cu.getSource();
7802
		String str = cu.getSource();
7695
		String completeBehind = "ne";
7803
		String completeBehind = "cla";
7696
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7804
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7697
		cu.codeComplete(cursorLocation, requestor);
7805
		cu.codeComplete(cursorLocation, requestor);
7698
7806
7699
		assertEquals(
7807
		assertEquals(
7700
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7808
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7809
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7810
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7701
			requestor.getResults());
7811
			requestor.getResults());
7702
}
7812
}
7703
public void testCompletionKeywordNew13() throws JavaModelException {
7813
public void testCompletionKeywordClass16() throws JavaModelException {
7704
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7814
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7705
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew13.java");
7815
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass16.java");
7706
7816
7707
		String str = cu.getSource();
7817
		String str = cu.getSource();
7708
		String completeBehind = "ne";
7818
		String completeBehind = "cla";
7709
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7819
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7710
		cu.codeComplete(cursorLocation, requestor);
7820
		cu.codeComplete(cursorLocation, requestor);
7711
7821
7712
		assertEquals(
7822
		assertEquals(
7713
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7823
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7824
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7825
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7714
			requestor.getResults());
7826
			requestor.getResults());
7715
}
7827
}
7716
public void testCompletionKeywordNew14() throws JavaModelException {
7828
public void testCompletionKeywordClass17() throws JavaModelException {
7717
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7829
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7718
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew14.java");
7830
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass17.java");
7719
7831
7720
		String str = cu.getSource();
7832
		String str = cu.getSource();
7721
		String completeBehind = "ne";
7833
		String completeBehind = "cla";
7722
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7834
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7723
		cu.codeComplete(cursorLocation, requestor);
7835
		cu.codeComplete(cursorLocation, requestor);
7724
7836
7725
		assertEquals(
7837
		assertEquals(
7726
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7838
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7727
			requestor.getResults());
7839
			requestor.getResults());
7728
}
7840
}
7729
public void testCompletionKeywordNew15() throws JavaModelException {
7841
public void testCompletionKeywordClass18() throws JavaModelException {
7730
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7842
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7731
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew15.java");
7843
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass18.java");
7732
7844
7733
		String str = cu.getSource();
7845
		String str = cu.getSource();
7734
		String completeBehind = "ne";
7846
		String completeBehind = "cla";
7735
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7847
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7736
		cu.codeComplete(cursorLocation, requestor);
7848
		cu.codeComplete(cursorLocation, requestor);
7737
7849
7738
		assertEquals(
7850
		assertEquals(
7739
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7851
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7740
			requestor.getResults());
7852
			requestor.getResults());
7741
}
7853
}
7742
public void testCompletionKeywordNew16() throws JavaModelException {
7854
public void testCompletionKeywordClass19() throws JavaModelException {
7743
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7855
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7744
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew16.java");
7856
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass19.java");
7745
7857
7746
		String str = cu.getSource();
7858
		String str = cu.getSource();
7747
		String completeBehind = "ne";
7859
		String completeBehind = "cla";
7748
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7860
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7749
		cu.codeComplete(cursorLocation, requestor);
7861
		cu.codeComplete(cursorLocation, requestor);
7750
7862
7751
		assertEquals(
7863
		assertEquals(
7752
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7864
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7753
			requestor.getResults());
7865
			requestor.getResults());
7754
}
7866
}
7755
public void testCompletionKeywordStatic6() throws JavaModelException {
7867
public void testCompletionKeywordClass20() throws JavaModelException {
7756
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7868
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7757
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic6.java");
7869
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass20.java");
7758
7870
7759
		String str = cu.getSource();
7871
		String str = cu.getSource();
7760
		String completeBehind = "sta";
7872
		String completeBehind = "cla";
7761
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7873
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7762
		cu.codeComplete(cursorLocation, requestor);
7874
		cu.codeComplete(cursorLocation, requestor);
7763
7875
7764
		assertEquals(
7876
		assertEquals(
7765
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7877
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7766
			requestor.getResults());
7878
			requestor.getResults());
7767
}
7879
}
7768
public void testCompletionKeywordStatic7() throws JavaModelException {
7880
public void testCompletionKeywordClass21() throws JavaModelException {
7769
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7881
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7770
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic7.java");
7882
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass21.java");
7771
7883
7772
		String str = cu.getSource();
7884
		String str = cu.getSource();
7773
		String completeBehind = "sta";
7885
		String completeBehind = "cla";
7774
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7886
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7775
		cu.codeComplete(cursorLocation, requestor);
7887
		cu.codeComplete(cursorLocation, requestor);
7776
7888
7777
		assertEquals(
7889
		assertEquals(
7778
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7890
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7891
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7892
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7779
			requestor.getResults());
7893
			requestor.getResults());
7780
}
7894
}
7781
public void testCompletionKeywordStatic8() throws JavaModelException {
7895
public void testCompletionKeywordClass22() throws JavaModelException {
7782
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7896
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7783
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic8.java");
7897
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass22.java");
7784
7898
7785
		String str = cu.getSource();
7899
		String str = cu.getSource();
7786
		String completeBehind = "sta";
7900
		String completeBehind = "cla";
7787
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7901
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7788
		cu.codeComplete(cursorLocation, requestor);
7902
		cu.codeComplete(cursorLocation, requestor);
7789
7903
7790
		assertEquals(
7904
		assertEquals(
7791
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7905
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7906
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7907
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7792
			requestor.getResults());
7908
			requestor.getResults());
7793
}
7909
}
7794
public void testCompletionKeywordStatic9() throws JavaModelException {
7910
public void testCompletionKeywordClass23() throws JavaModelException {
7795
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7911
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7796
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic9.java");
7912
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass23.java");
7797
7913
7798
		String str = cu.getSource();
7914
		String str = cu.getSource();
7799
		String completeBehind = "sta";
7915
		String completeBehind = "cla";
7800
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7916
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7801
		cu.codeComplete(cursorLocation, requestor);
7917
		cu.codeComplete(cursorLocation, requestor);
7802
7918
7803
		assertEquals(
7919
		assertEquals(
7804
			"",
7920
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7921
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7922
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7805
			requestor.getResults());
7923
			requestor.getResults());
7806
}
7924
}
7807
public void testCompletionKeywordStatic10() throws JavaModelException {
7925
public void testCompletionKeywordClass24() throws JavaModelException {
7808
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7926
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7809
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic10.java");
7927
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordClass24.java");
7810
7928
7811
		String str = cu.getSource();
7929
		String str = cu.getSource();
7812
		String completeBehind = "sta";
7930
		String completeBehind = "cla";
7813
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7931
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7814
		cu.codeComplete(cursorLocation, requestor);
7932
		cu.codeComplete(cursorLocation, requestor);
7815
7933
7816
		assertEquals(
7934
		assertEquals(
7817
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7935
			"element:Class    completion:Class    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7936
			"element:ClassWithComplexName    completion:ClassWithComplexName    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
7937
			"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7818
			requestor.getResults());
7938
			requestor.getResults());
7819
}
7939
}
7820
public void testCompletionKeywordPublic20() throws JavaModelException {
7940
public void testCompletionKeywordInterface10() throws JavaModelException {
7821
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7941
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7822
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
7942
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface1.java");
7823
7943
7824
		String str = cu.getSource();
7944
		String str = cu.getSource();
7825
		String completeBehind = "pub";
7945
		String completeBehind = "interf";
7826
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7946
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7827
		cu.codeComplete(cursorLocation, requestor);
7947
		cu.codeComplete(cursorLocation, requestor);
7828
7948
7829
		assertEquals(
7949
		assertEquals(
7830
			"",
7950
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7831
			requestor.getResults());
7951
			requestor.getResults());
7832
}
7952
}
7833
public void testCompletionKeywordPublic11() throws JavaModelException {
7953
public void testCompletionKeywordInterface11() throws JavaModelException {
7834
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7954
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7835
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic11.java");
7955
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface11.java");
7836
7956
7837
		String str = cu.getSource();
7957
		String str = cu.getSource();
7838
		String completeBehind = "pub";
7958
		String completeBehind = "interf";
7839
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7959
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7840
		cu.codeComplete(cursorLocation, requestor);
7960
		cu.codeComplete(cursorLocation, requestor);
7841
7961
7842
		assertEquals(
7962
		assertEquals(
7843
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7963
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7844
			requestor.getResults());
7964
			requestor.getResults());
7845
}
7965
}
7846
public void testCompletionKeywordPublic12() throws JavaModelException {
7966
public void testCompletionKeywordInterface12() throws JavaModelException {
7847
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7967
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7848
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic12.java");
7968
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface12.java");
7849
7969
7850
		String str = cu.getSource();
7970
		String str = cu.getSource();
7851
		String completeBehind = "pub";
7971
		String completeBehind = "interf";
7852
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7972
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7853
		cu.codeComplete(cursorLocation, requestor);
7973
		cu.codeComplete(cursorLocation, requestor);
7854
7974
7855
		assertEquals(
7975
		assertEquals(
7856
			"",
7976
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7857
			requestor.getResults());
7977
			requestor.getResults());
7858
}
7978
}
7859
public void testCompletionKeywordPublic13() throws JavaModelException {
7979
public void testCompletionKeywordInterface13() throws JavaModelException {
7860
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7980
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7861
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic13.java");
7981
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface13.java");
7862
7982
7863
		String str = cu.getSource();
7983
		String str = cu.getSource();
7864
		String completeBehind = "pub";
7984
		String completeBehind = "interf";
7865
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7985
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7866
		cu.codeComplete(cursorLocation, requestor);
7986
		cu.codeComplete(cursorLocation, requestor);
7867
7987
7868
		assertEquals(
7988
		assertEquals(
7869
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7989
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7870
			requestor.getResults());
7990
			requestor.getResults());
7871
}
7991
}
7872
public void testCompletionKeywordPublic14() throws JavaModelException {
7992
public void testCompletionKeywordInterface14() throws JavaModelException {
7873
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7993
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7874
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic14.java");
7994
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface14.java");
7875
7995
7876
		String str = cu.getSource();
7996
		String str = cu.getSource();
7877
		String completeBehind = "pub";
7997
		String completeBehind = "interf";
7878
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7998
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7879
		cu.codeComplete(cursorLocation, requestor);
7999
		cu.codeComplete(cursorLocation, requestor);
7880
8000
7881
		assertEquals(
8001
		assertEquals(
7882
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8002
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7883
			requestor.getResults());
8003
			requestor.getResults());
7884
}
8004
}
7885
public void testCompletionKeywordPublic15() throws JavaModelException {
8005
public void testCompletionKeywordInterface15() throws JavaModelException {
7886
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8006
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7887
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic15.java");
8007
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface15.java");
7888
8008
7889
		String str = cu.getSource();
8009
		String str = cu.getSource();
7890
		String completeBehind = "pub";
8010
		String completeBehind = "interf";
7891
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8011
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7892
		cu.codeComplete(cursorLocation, requestor);
8012
		cu.codeComplete(cursorLocation, requestor);
7893
8013
7894
		assertEquals(
8014
		assertEquals(
7895
			"",
8015
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7896
			requestor.getResults());
8016
			requestor.getResults());
7897
}
8017
}
7898
public void testCompletionKeywordPublic16() throws JavaModelException {
8018
public void testCompletionKeywordInterface16() throws JavaModelException {
7899
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8019
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7900
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic16.java");
8020
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface16.java");
7901
8021
7902
		String str = cu.getSource();
8022
		String str = cu.getSource();
7903
		String completeBehind = "pub";
8023
		String completeBehind = "interf";
7904
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8024
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7905
		cu.codeComplete(cursorLocation, requestor);
8025
		cu.codeComplete(cursorLocation, requestor);
7906
8026
7907
		assertEquals(
8027
		assertEquals(
7908
			"",
8028
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7909
			requestor.getResults());
8029
			requestor.getResults());
7910
}
8030
}
7911
public void testCompletionKeywordPublic17() throws JavaModelException {
8031
public void testCompletionKeywordInterface17() throws JavaModelException {
7912
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8032
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7913
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic17.java");
8033
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface17.java");
7914
8034
7915
		String str = cu.getSource();
8035
		String str = cu.getSource();
7916
		String completeBehind = "pub";
8036
		String completeBehind = "interf";
7917
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8037
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7918
		cu.codeComplete(cursorLocation, requestor);
8038
		cu.codeComplete(cursorLocation, requestor);
7919
8039
7920
		assertEquals(
8040
		assertEquals(
7921
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8041
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7922
			requestor.getResults());
8042
			requestor.getResults());
7923
}
8043
}
7924
public void testCompletionKeywordPublic18() throws JavaModelException {
8044
public void testCompletionKeywordInterface18() throws JavaModelException {
7925
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8045
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7926
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic18.java");
8046
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInterface18.java");
7927
8047
7928
		String str = cu.getSource();
8048
		String str = cu.getSource();
7929
		String completeBehind = "pub";
8049
		String completeBehind = "interf";
7930
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8050
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7931
		cu.codeComplete(cursorLocation, requestor);
8051
		cu.codeComplete(cursorLocation, requestor);
7932
8052
7933
		assertEquals(
8053
		assertEquals(
7934
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8054
			"element:interface    completion:interface    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7935
			requestor.getResults());
8055
			requestor.getResults());
7936
}
8056
}
7937
public void testCompletionKeywordPublic19() throws JavaModelException {
8057
public void testCompletionKeywordThrows5() throws JavaModelException {
7938
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8058
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7939
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic19.java");
8059
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows5.java");
7940
8060
7941
		String str = cu.getSource();
8061
		String str = cu.getSource();
7942
		String completeBehind = "pub";
8062
		String completeBehind = "thro";
7943
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8063
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7944
		cu.codeComplete(cursorLocation, requestor);
8064
		cu.codeComplete(cursorLocation, requestor);
7945
8065
7946
		assertEquals(
8066
		assertEquals(
7947
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8067
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7948
			requestor.getResults());
8068
			requestor.getResults());
7949
}
8069
}
7950
public void testCompletionKeywordPrivate6() throws JavaModelException {
8070
public void testCompletionKeywordThrows6() throws JavaModelException {
7951
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8071
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7952
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate6.java");
8072
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows6.java");
7953
8073
7954
		String str = cu.getSource();
8074
		String str = cu.getSource();
7955
		String completeBehind = "pri";
8075
		String completeBehind = "thro";
7956
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8076
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7957
		cu.codeComplete(cursorLocation, requestor);
8077
		cu.codeComplete(cursorLocation, requestor);
7958
8078
7959
		assertEquals(
8079
		assertEquals(
7960
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8080
			"",
7961
			requestor.getResults());
8081
			requestor.getResults());
7962
}
8082
}
7963
public void testCompletionKeywordPrivate7() throws JavaModelException {
8083
public void testCompletionKeywordThrows7() throws JavaModelException {
7964
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8084
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7965
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate7.java");
8085
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows7.java");
7966
8086
7967
		String str = cu.getSource();
8087
		String str = cu.getSource();
7968
		String completeBehind = "pri";
8088
		String completeBehind = "thro";
7969
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8089
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7970
		cu.codeComplete(cursorLocation, requestor);
8090
		cu.codeComplete(cursorLocation, requestor);
7971
8091
7972
		assertEquals(
8092
		assertEquals(
7973
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8093
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7974
			requestor.getResults());
8094
			requestor.getResults());
7975
}
8095
}
7976
public void testCompletionKeywordPrivate8() throws JavaModelException {
8096
public void testCompletionKeywordThrows8() throws JavaModelException {
7977
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8097
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7978
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate8.java");
8098
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordThrows8.java");
7979
8099
7980
		String str = cu.getSource();
8100
		String str = cu.getSource();
7981
		String completeBehind = "pri";
8101
		String completeBehind = "thro";
7982
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8102
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7983
		cu.codeComplete(cursorLocation, requestor);
8103
		cu.codeComplete(cursorLocation, requestor);
7984
8104
7985
		assertEquals(
8105
		assertEquals(
7986
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8106
			"element:throws    completion:throws    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
7987
			requestor.getResults());
8107
			requestor.getResults());
7988
}
8108
}
7989
public void testCompletionKeywordPrivate9() throws JavaModelException {
8109
public void testCompletionKeywordSynchronized7() throws JavaModelException {
7990
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8110
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
7991
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate9.java");
8111
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized7.java");
7992
8112
7993
		String str = cu.getSource();
8113
		String str = cu.getSource();
7994
		String completeBehind = "pri";
8114
		String completeBehind = "syn";
7995
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8115
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
7996
		cu.codeComplete(cursorLocation, requestor);
8116
		cu.codeComplete(cursorLocation, requestor);
7997
8117
7998
		assertEquals(
8118
		assertEquals(
7999
			"",
8119
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8000
			requestor.getResults());
8120
			requestor.getResults());
8001
}
8121
}
8002
public void testCompletionKeywordPrivate10() throws JavaModelException {
8122
public void testCompletionKeywordSynchronized8() throws JavaModelException {
8003
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8123
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8004
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate10.java");
8124
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized8.java");
8005
8125
8006
		String str = cu.getSource();
8126
		String str = cu.getSource();
8007
		String completeBehind = "pri";
8127
		String completeBehind = "syn";
8008
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8128
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8009
		cu.codeComplete(cursorLocation, requestor);
8129
		cu.codeComplete(cursorLocation, requestor);
8010
8130
Lines 8012-8062 Link Here
8012
			"",
8132
			"",
8013
			requestor.getResults());
8133
			requestor.getResults());
8014
}
8134
}
8015
public void testCompletionKeywordProtected6() throws JavaModelException {
8135
public void testCompletionKeywordSynchronized9() throws JavaModelException {
8016
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8136
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8017
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected6.java");
8137
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized9.java");
8018
8138
8019
		String str = cu.getSource();
8139
		String str = cu.getSource();
8020
		String completeBehind = "pro";
8140
		String completeBehind = "syn";
8021
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8141
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8022
		cu.codeComplete(cursorLocation, requestor);
8142
		cu.codeComplete(cursorLocation, requestor);
8023
8143
8024
		assertEquals(
8144
		assertEquals(
8025
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8145
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8026
			requestor.getResults());
8146
			requestor.getResults());
8027
}
8147
}
8028
public void testCompletionKeywordProtected7() throws JavaModelException {
8148
public void testCompletionKeywordSynchronized10() throws JavaModelException {
8029
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8149
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8030
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected7.java");
8150
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized10.java");
8031
8151
8032
		String str = cu.getSource();
8152
		String str = cu.getSource();
8033
		String completeBehind = "pro";
8153
		String completeBehind = "syn";
8034
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8154
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8035
		cu.codeComplete(cursorLocation, requestor);
8155
		cu.codeComplete(cursorLocation, requestor);
8036
8156
8037
		assertEquals(
8157
		assertEquals(
8038
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8158
			"",
8039
			requestor.getResults());
8159
			requestor.getResults());
8040
}
8160
}
8041
public void testCompletionKeywordProtected8() throws JavaModelException {
8161
public void testCompletionKeywordSynchronized11() throws JavaModelException {
8042
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8162
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8043
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected8.java");
8163
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized11.java");
8044
8164
8045
		String str = cu.getSource();
8165
		String str = cu.getSource();
8046
		String completeBehind = "pro";
8166
		String completeBehind = "syn";
8047
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8167
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8048
		cu.codeComplete(cursorLocation, requestor);
8168
		cu.codeComplete(cursorLocation, requestor);
8049
8169
8050
		assertEquals(
8170
		assertEquals(
8051
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8171
			"element:synchronized    completion:synchronized    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8052
			requestor.getResults());
8172
			requestor.getResults());
8053
}
8173
}
8054
public void testCompletionKeywordProtected9() throws JavaModelException {
8174
public void testCompletionKeywordSynchronized12() throws JavaModelException {
8055
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8175
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8056
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected9.java");
8176
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordSynchronized12.java");
8057
8177
8058
		String str = cu.getSource();
8178
		String str = cu.getSource();
8059
		String completeBehind = "pro";
8179
		String completeBehind = "syn";
8060
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8180
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8061
		cu.codeComplete(cursorLocation, requestor);
8181
		cu.codeComplete(cursorLocation, requestor);
8062
8182
Lines 8064-8115 Link Here
8064
			"",
8184
			"",
8065
			requestor.getResults());
8185
			requestor.getResults());
8066
}
8186
}
8067
public void testCompletionKeywordProtected10() throws JavaModelException {
8187
public void testCompletionKeywordNative5() throws JavaModelException {
8068
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8188
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8069
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected10.java");
8189
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative5.java");
8070
8190
8071
		String str = cu.getSource();
8191
		String str = cu.getSource();
8072
		String completeBehind = "pro";
8192
		String completeBehind = "nat";
8073
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8193
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8074
		cu.codeComplete(cursorLocation, requestor);
8194
		cu.codeComplete(cursorLocation, requestor);
8075
8195
8076
		assertEquals(
8196
		assertEquals(
8077
			"",
8197
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8078
			requestor.getResults());
8198
			requestor.getResults());
8079
}
8199
}
8080
public void testCompletionKeywordFinal18() throws JavaModelException {
8200
public void testCompletionKeywordNative6() throws JavaModelException {
8081
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8201
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8082
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal18.java");
8202
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative6.java");
8083
8203
8084
		String str = cu.getSource();
8204
		String str = cu.getSource();
8085
		String completeBehind = "fin";
8205
		String completeBehind = "nat";
8086
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8206
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8087
		cu.codeComplete(cursorLocation, requestor);
8207
		cu.codeComplete(cursorLocation, requestor);
8088
8208
8089
		assertEquals(
8209
		assertEquals(
8090
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8210
			"",
8091
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8092
			requestor.getResults());
8211
			requestor.getResults());
8093
}
8212
}
8094
public void testCompletionKeywordFinal10() throws JavaModelException {
8213
public void testCompletionKeywordNative7() throws JavaModelException {
8095
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8214
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8096
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal10.java");
8215
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative7.java");
8097
8216
8098
		String str = cu.getSource();
8217
		String str = cu.getSource();
8099
		String completeBehind = "fin";
8218
		String completeBehind = "nat";
8100
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8219
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8101
		cu.codeComplete(cursorLocation, requestor);
8220
		cu.codeComplete(cursorLocation, requestor);
8102
8221
8103
		assertEquals(
8222
		assertEquals(
8104
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8223
			"element:native    completion:native    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8105
			requestor.getResults());
8224
			requestor.getResults());
8106
}
8225
}
8107
public void testCompletionKeywordFinal11() throws JavaModelException {
8226
public void testCompletionKeywordNative8() throws JavaModelException {
8108
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8227
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8109
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal11.java");
8228
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNative8.java");
8110
8229
8111
		String str = cu.getSource();
8230
		String str = cu.getSource();
8112
		String completeBehind = "fin";
8231
		String completeBehind = "nat";
8113
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8232
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8114
		cu.codeComplete(cursorLocation, requestor);
8233
		cu.codeComplete(cursorLocation, requestor);
8115
8234
Lines 8117-8168 Link Here
8117
			"",
8236
			"",
8118
			requestor.getResults());
8237
			requestor.getResults());
8119
}
8238
}
8120
public void testCompletionKeywordFinal12() throws JavaModelException {
8239
public void testCompletionKeywordStrictfp5() throws JavaModelException {
8121
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8240
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8122
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal12.java");
8241
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp5.java");
8123
8242
8124
		String str = cu.getSource();
8243
		String str = cu.getSource();
8125
		String completeBehind = "fin";
8244
		String completeBehind = "stric";
8126
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8245
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8127
		cu.codeComplete(cursorLocation, requestor);
8246
		cu.codeComplete(cursorLocation, requestor);
8128
8247
8129
		assertEquals(
8248
		assertEquals(
8130
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8249
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8131
			requestor.getResults());
8250
			requestor.getResults());
8132
}
8251
}
8133
public void testCompletionKeywordFinal13() throws JavaModelException {
8252
public void testCompletionKeywordStrictfp6() throws JavaModelException {
8134
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8253
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8135
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal13.java");
8254
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp6.java");
8136
8255
8137
		String str = cu.getSource();
8256
		String str = cu.getSource();
8138
		String completeBehind = "fin";
8257
		String completeBehind = "stric";
8139
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8258
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8140
		cu.codeComplete(cursorLocation, requestor);
8259
		cu.codeComplete(cursorLocation, requestor);
8141
8260
8142
		assertEquals(
8261
		assertEquals(
8143
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8262
			"",
8144
			requestor.getResults());
8263
			requestor.getResults());
8145
}
8264
}
8146
public void testCompletionKeywordFinal14() throws JavaModelException {
8265
public void testCompletionKeywordStrictfp7() throws JavaModelException {
8147
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8266
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8148
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal14.java");
8267
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp7.java");
8149
8268
8150
		String str = cu.getSource();
8269
		String str = cu.getSource();
8151
		String completeBehind = "fin";
8270
		String completeBehind = "stric";
8152
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8271
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8153
		cu.codeComplete(cursorLocation, requestor);
8272
		cu.codeComplete(cursorLocation, requestor);
8154
8273
8155
		assertEquals(
8274
		assertEquals(
8156
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8275
			"element:strictfp    completion:strictfp    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8157
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
8158
			requestor.getResults());
8276
			requestor.getResults());
8159
}
8277
}
8160
public void testCompletionKeywordFinal15() throws JavaModelException {
8278
public void testCompletionKeywordStrictfp8() throws JavaModelException {
8161
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8279
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8162
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal15.java");
8280
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStrictfp8.java");
8163
8281
8164
		String str = cu.getSource();
8282
		String str = cu.getSource();
8165
		String completeBehind = "fin";
8283
		String completeBehind = "stric";
8166
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8284
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8167
		cu.codeComplete(cursorLocation, requestor);
8285
		cu.codeComplete(cursorLocation, requestor);
8168
8286
Lines 8170-8221 Link Here
8170
			"",
8288
			"",
8171
			requestor.getResults());
8289
			requestor.getResults());
8172
}
8290
}
8173
public void testCompletionKeywordFinal16() throws JavaModelException {
8291
public void testCompletionKeywordVolatile5() throws JavaModelException {
8174
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8292
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8175
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal16.java");
8293
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile5.java");
8176
8294
8177
		String str = cu.getSource();
8295
		String str = cu.getSource();
8178
		String completeBehind = "fin";
8296
		String completeBehind = "vol";
8179
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8297
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8180
		cu.codeComplete(cursorLocation, requestor);
8298
		cu.codeComplete(cursorLocation, requestor);
8181
8299
8182
		assertEquals(
8300
		assertEquals(
8183
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8301
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8184
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
8185
			requestor.getResults());
8302
			requestor.getResults());
8186
}
8303
}
8187
public void testCompletionKeywordFinal17() throws JavaModelException {
8304
public void testCompletionKeywordVolatile6() throws JavaModelException {
8188
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8305
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8189
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal17.java");
8306
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile6.java");
8190
8307
8191
		String str = cu.getSource();
8308
		String str = cu.getSource();
8192
		String completeBehind = "fin";
8309
		String completeBehind = "vol";
8193
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8310
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8194
		cu.codeComplete(cursorLocation, requestor);
8311
		cu.codeComplete(cursorLocation, requestor);
8195
8312
8196
		assertEquals(
8313
		assertEquals(
8197
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8314
			"",
8198
			requestor.getResults());
8315
			requestor.getResults());
8199
}
8316
}
8200
public void testCompletionKeywordAbstract9() throws JavaModelException {
8317
public void testCompletionKeywordVolatile7() throws JavaModelException {
8201
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8318
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8202
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract9.java");
8319
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile7.java");
8203
8320
8204
		String str = cu.getSource();
8321
		String str = cu.getSource();
8205
		String completeBehind = "abs";
8322
		String completeBehind = "vol";
8206
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8323
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8207
		cu.codeComplete(cursorLocation, requestor);
8324
		cu.codeComplete(cursorLocation, requestor);
8208
8325
8209
		assertEquals(
8326
		assertEquals(
8210
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8327
			"element:volatile    completion:volatile    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8211
			requestor.getResults());
8328
			requestor.getResults());
8212
}
8329
}
8213
public void testCompletionKeywordAbstract10() throws JavaModelException {
8330
public void testCompletionKeywordVolatile8() throws JavaModelException {
8214
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8331
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8215
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract10.java");
8332
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordVolatile8.java");
8216
8333
8217
		String str = cu.getSource();
8334
		String str = cu.getSource();
8218
		String completeBehind = "abs";
8335
		String completeBehind = "vol";
8219
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8336
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8220
		cu.codeComplete(cursorLocation, requestor);
8337
		cu.codeComplete(cursorLocation, requestor);
8221
8338
Lines 8223-8273 Link Here
8223
			"",
8340
			"",
8224
			requestor.getResults());
8341
			requestor.getResults());
8225
}
8342
}
8226
public void testCompletionKeywordAbstract11() throws JavaModelException {
8343
public void testCompletionKeywordTransient5() throws JavaModelException {
8227
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8344
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8228
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract11.java");
8345
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient5.java");
8229
8346
8230
		String str = cu.getSource();
8347
		String str = cu.getSource();
8231
		String completeBehind = "abs";
8348
		String completeBehind = "tran";
8232
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8349
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8233
		cu.codeComplete(cursorLocation, requestor);
8350
		cu.codeComplete(cursorLocation, requestor);
8234
8351
8235
		assertEquals(
8352
		assertEquals(
8236
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8353
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8237
			requestor.getResults());
8354
			requestor.getResults());
8238
}
8355
}
8239
public void testCompletionKeywordAbstract12() throws JavaModelException {
8356
public void testCompletionKeywordTransient6() throws JavaModelException {
8240
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8357
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8241
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract12.java");
8358
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient6.java");
8242
8359
8243
		String str = cu.getSource();
8360
		String str = cu.getSource();
8244
		String completeBehind = "abs";
8361
		String completeBehind = "tran";
8245
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8362
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8246
		cu.codeComplete(cursorLocation, requestor);
8363
		cu.codeComplete(cursorLocation, requestor);
8247
8364
8248
		assertEquals(
8365
		assertEquals(
8249
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8366
			"",
8250
			requestor.getResults());
8367
			requestor.getResults());
8251
}
8368
}
8252
public void testCompletionKeywordAbstract13() throws JavaModelException {
8369
public void testCompletionKeywordTransient7() throws JavaModelException {
8253
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8370
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8254
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract13.java");
8371
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient7.java");
8255
8372
8256
		String str = cu.getSource();
8373
		String str = cu.getSource();
8257
		String completeBehind = "abs";
8374
		String completeBehind = "tran";
8258
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8375
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8259
		cu.codeComplete(cursorLocation, requestor);
8376
		cu.codeComplete(cursorLocation, requestor);
8260
8377
8261
		assertEquals(
8378
		assertEquals(
8262
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8379
			"element:transient    completion:transient    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8263
			requestor.getResults());
8380
			requestor.getResults());
8264
}
8381
}
8265
public void testCompletionKeywordAbstract14() throws JavaModelException {
8382
public void testCompletionKeywordTransient8() throws JavaModelException {
8266
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8383
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8267
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract14.java");
8384
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTransient8.java");
8268
8385
8269
		String str = cu.getSource();
8386
		String str = cu.getSource();
8270
		String completeBehind = "abs";
8387
		String completeBehind = "tran";
8271
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8388
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8272
		cu.codeComplete(cursorLocation, requestor);
8389
		cu.codeComplete(cursorLocation, requestor);
8273
8390
Lines 8275-8497 Link Here
8275
			"",
8392
			"",
8276
			requestor.getResults());
8393
			requestor.getResults());
8277
}
8394
}
8278
public void testCompletionKeywordAbstract15() throws JavaModelException {
8395
public void testCompletionKeywordNew9() throws JavaModelException {
8279
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8396
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8280
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract15.java");
8397
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew9.java");
8281
8398
8282
		String str = cu.getSource();
8399
		String str = cu.getSource();
8283
		String completeBehind = "abs";
8400
		String completeBehind = "ne";
8284
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8401
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8285
		cu.codeComplete(cursorLocation, requestor);
8402
		cu.codeComplete(cursorLocation, requestor);
8286
8403
8287
		assertEquals(
8404
		assertEquals(
8288
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8405
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8289
			requestor.getResults());
8406
			requestor.getResults());
8290
}
8407
}
8291
public void testCompletionKeywordAbstract16() throws JavaModelException {
8408
public void testCompletionKeywordNew10() throws JavaModelException {
8292
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8409
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8293
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract16.java");
8410
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew10.java");
8294
8411
8295
		String str = cu.getSource();
8412
		String str = cu.getSource();
8296
		String completeBehind = "abs";
8413
		String completeBehind = "ne";
8297
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8414
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8298
		cu.codeComplete(cursorLocation, requestor);
8415
		cu.codeComplete(cursorLocation, requestor);
8299
8416
8300
		assertEquals(
8417
		assertEquals(
8301
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8418
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8302
			requestor.getResults());
8419
			requestor.getResults());
8303
}
8420
}
8304
public void testCompletionKeywordTrue3() throws JavaModelException {
8421
public void testCompletionKeywordNew11() throws JavaModelException {
8305
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8422
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8306
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue3.java");
8423
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew11.java");
8307
8424
8308
		String str = cu.getSource();
8425
		String str = cu.getSource();
8309
		String completeBehind = "tru";
8426
		String completeBehind = "ne";
8310
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8427
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8311
		cu.codeComplete(cursorLocation, requestor);
8428
		cu.codeComplete(cursorLocation, requestor);
8312
8429
8313
		assertEquals(
8430
		assertEquals(
8314
			"",
8431
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8315
			requestor.getResults());
8432
			requestor.getResults());
8316
}
8433
}
8317
public void testCompletionKeywordTrue4() throws JavaModelException {
8434
public void testCompletionKeywordNew12() throws JavaModelException {
8318
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8435
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8319
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue4.java");
8436
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew12.java");
8320
8437
8321
		String str = cu.getSource();
8438
		String str = cu.getSource();
8322
		String completeBehind = "tru";
8439
		String completeBehind = "ne";
8323
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8440
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8324
		cu.codeComplete(cursorLocation, requestor);
8441
		cu.codeComplete(cursorLocation, requestor);
8325
8442
8326
		assertEquals(
8443
		assertEquals(
8327
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
8444
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8328
			requestor.getResults());
8329
}
8330
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615
8331
public void testCompletionKeywordTrue5() throws JavaModelException {
8332
	this.wc = getWorkingCopy(
8333
			"/Completion/src/test/CompletionKeywordTrue5.java",
8334
			"package test;\n" +
8335
			"public class CompletionKeywordTrue5 {\n" +
8336
			"  public void foo() {\n" +
8337
			"    boolean var;\n" +
8338
			"    var = tr\n" +
8339
			"  }\n" +
8340
			"}");
8341
	
8342
	
8343
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8344
	String str = this.wc.getSource();
8345
	String completeBehind = "tr";
8346
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8347
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8348
8349
	assertResults(
8350
			"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}",
8351
			requestor.getResults());
8445
			requestor.getResults());
8352
}
8446
}
8353
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615
8447
public void testCompletionKeywordNew13() throws JavaModelException {
8354
public void testCompletionKeywordTrue6() throws JavaModelException {
8448
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8355
	this.wc = getWorkingCopy(
8449
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew13.java");
8356
			"/Completion/src/test/CompletionKeywordTrue6.java",
8450
8357
			"package test;\n" +
8451
		String str = cu.getSource();
8358
			"public class CompletionKeywordTrue6 {\n" +
8452
		String completeBehind = "ne";
8359
			"  public void foo() {\n" +
8453
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8360
			"    boolean var;\n" +
8454
		cu.codeComplete(cursorLocation, requestor);
8361
			"    var = \n" +
8455
8362
			"  }\n" +
8456
		assertEquals(
8363
			"}");
8457
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8364
	
8458
			requestor.getResults());
8365
	
8366
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8367
	String str = this.wc.getSource();
8368
	String completeBehind = "var = ";
8369
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8370
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8371
8372
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
8373
		assertResults(
8374
				"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8375
				"finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8376
				"foo[METHOD_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8377
				"getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8378
				"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8379
				"notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8380
				"notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8381
				"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8382
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8383
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8384
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8385
				"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
8386
				"var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
8387
				"false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+
8388
				"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}",
8389
				requestor.getResults());
8390
	} else {
8391
		assertResults(
8392
				"CompletionKeywordTrue6[TYPE_REF]{CompletionKeywordTrue6, test, Ltest.CompletionKeywordTrue6;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8393
				"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8394
				"finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8395
				"foo[METHOD_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8396
				"getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8397
				"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8398
				"notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8399
				"notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8400
				"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8401
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8402
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8403
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8404
				"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
8405
				"var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
8406
				"false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+
8407
				"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}",
8408
				requestor.getResults());
8409
	}
8410
}
8459
}
8411
public void testCompletionKeywordFalse3() throws JavaModelException {
8460
public void testCompletionKeywordNew14() throws JavaModelException {
8412
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8461
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8413
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse3.java");
8462
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew14.java");
8414
8463
8415
		String str = cu.getSource();
8464
		String str = cu.getSource();
8416
		String completeBehind = "fal";
8465
		String completeBehind = "ne";
8417
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8466
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8418
		cu.codeComplete(cursorLocation, requestor);
8467
		cu.codeComplete(cursorLocation, requestor);
8419
8468
8420
		assertEquals(
8469
		assertEquals(
8421
			"",
8470
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8422
			requestor.getResults());
8471
			requestor.getResults());
8423
}
8472
}
8424
public void testCompletionKeywordFalse4() throws JavaModelException {
8473
public void testCompletionKeywordNew15() throws JavaModelException {
8425
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8474
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8426
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse4.java");
8475
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew15.java");
8427
8476
8428
		String str = cu.getSource();
8477
		String str = cu.getSource();
8429
		String completeBehind = "fal";
8478
		String completeBehind = "ne";
8430
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8479
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8431
		cu.codeComplete(cursorLocation, requestor);
8480
		cu.codeComplete(cursorLocation, requestor);
8432
8481
8433
		assertEquals(
8482
		assertEquals(
8434
			"element:false    completion:false    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
8483
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8435
			requestor.getResults());
8484
			requestor.getResults());
8436
}
8485
}
8437
public void testCompletionKeywordNull3() throws JavaModelException {
8486
public void testCompletionKeywordNew16() throws JavaModelException {
8438
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8487
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8439
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull3.java");
8488
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNew16.java");
8440
8489
8441
		String str = cu.getSource();
8490
		String str = cu.getSource();
8442
		String completeBehind = "nul";
8491
		String completeBehind = "ne";
8443
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8492
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8444
		cu.codeComplete(cursorLocation, requestor);
8493
		cu.codeComplete(cursorLocation, requestor);
8445
8494
8446
		assertEquals(
8495
		assertEquals(
8447
			"",
8496
			"element:new    completion:new    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8448
			requestor.getResults());
8497
			requestor.getResults());
8449
}
8498
}
8450
public void testCompletionKeywordNull4() throws JavaModelException {
8499
public void testCompletionKeywordStatic6() throws JavaModelException {
8451
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8500
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8452
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull4.java");
8501
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic6.java");
8453
8502
8454
		String str = cu.getSource();
8503
		String str = cu.getSource();
8455
		String completeBehind = "nul";
8504
		String completeBehind = "sta";
8456
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8505
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8457
		cu.codeComplete(cursorLocation, requestor);
8506
		cu.codeComplete(cursorLocation, requestor);
8458
8507
8459
		assertEquals(
8508
		assertEquals(
8460
			"element:null    completion:null    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8509
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8461
			requestor.getResults());
8510
			requestor.getResults());
8462
}
8511
}
8463
public void testCompletionKeywordInstanceof4() throws JavaModelException {
8512
public void testCompletionKeywordStatic7() throws JavaModelException {
8464
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8513
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8465
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof4.java");
8514
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic7.java");
8466
8515
8467
		String str = cu.getSource();
8516
		String str = cu.getSource();
8468
		String completeBehind = "ins";
8517
		String completeBehind = "sta";
8469
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8518
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8470
		cu.codeComplete(cursorLocation, requestor);
8519
		cu.codeComplete(cursorLocation, requestor);
8471
8520
8472
		assertEquals(
8521
		assertEquals(
8473
			"element:instanceof    completion:instanceof    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8522
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8474
			requestor.getResults());
8523
			requestor.getResults());
8475
}
8524
}
8476
public void testCompletionKeywordInstanceof5() throws JavaModelException {
8525
public void testCompletionKeywordStatic8() throws JavaModelException {
8477
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8526
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8478
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof5.java");
8527
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic8.java");
8479
8528
8480
		String str = cu.getSource();
8529
		String str = cu.getSource();
8481
		String completeBehind = "ins";
8530
		String completeBehind = "sta";
8482
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8531
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8483
		cu.codeComplete(cursorLocation, requestor);
8532
		cu.codeComplete(cursorLocation, requestor);
8484
8533
8485
		assertEquals(
8534
		assertEquals(
8486
			"",
8535
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8487
			requestor.getResults());
8536
			requestor.getResults());
8488
}
8537
}
8489
public void testCompletionKeywordInstanceof6() throws JavaModelException {
8538
public void testCompletionKeywordStatic9() throws JavaModelException {
8490
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8539
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8491
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof6.java");
8540
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic9.java");
8492
8541
8493
		String str = cu.getSource();
8542
		String str = cu.getSource();
8494
		String completeBehind = "ins";
8543
		String completeBehind = "sta";
8495
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8544
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8496
		cu.codeComplete(cursorLocation, requestor);
8545
		cu.codeComplete(cursorLocation, requestor);
8497
8546
Lines 8499-12392 Link Here
8499
			"",
8548
			"",
8500
			requestor.getResults());
8549
			requestor.getResults());
8501
}
8550
}
8502
public void testCompletionMemberType2() throws JavaModelException {
8551
public void testCompletionKeywordStatic10() throws JavaModelException {
8503
	this.wc = getWorkingCopy(
8552
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8504
            "/Completion/src/test/CompletionMemberType2.java",
8553
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordStatic10.java");
8505
            "public class CompletionMemberType2 {\n"+
8506
            "	public class MemberException extends Exception {\n"+
8507
            "	}\n"+
8508
            "	void foo() {\n"+
8509
            "		throw new \n"+
8510
            "	}\n"+
8511
            "}");
8512
    
8513
    
8514
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8515
    String str = this.wc.getSource();
8516
    String completeBehind = "new ";
8517
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8518
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8519
8554
8520
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
8555
		String str = cu.getSource();
8521
		assertResults(
8556
		String completeBehind = "sta";
8557
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8558
		cu.codeComplete(cursorLocation, requestor);
8559
8560
		assertEquals(
8561
			"element:static    completion:static    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8562
			requestor.getResults());
8563
}
8564
public void testCompletionKeywordPublic20() throws JavaModelException {
8565
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8566
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic10.java");
8567
8568
		String str = cu.getSource();
8569
		String completeBehind = "pub";
8570
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8571
		cu.codeComplete(cursorLocation, requestor);
8572
8573
		assertEquals(
8522
			"",
8574
			"",
8523
			requestor.getResults());
8575
			requestor.getResults());
8524
	} else {
8576
}
8525
		assertResults(
8577
public void testCompletionKeywordPublic11() throws JavaModelException {
8526
			"CompletionMemberType2[TYPE_REF]{CompletionMemberType2, test, Ltest.CompletionMemberType2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
8578
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8527
			"CompletionMemberType2.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_NON_RESTRICTED)+"}",
8579
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic11.java");
8580
8581
		String str = cu.getSource();
8582
		String completeBehind = "pub";
8583
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8584
		cu.codeComplete(cursorLocation, requestor);
8585
8586
		assertEquals(
8587
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8528
			requestor.getResults());
8588
			requestor.getResults());
8529
	}
8530
}
8589
}
8531
public void testCompletionMemberType3() throws JavaModelException {
8590
public void testCompletionKeywordPublic12() throws JavaModelException {
8532
	this.wc = getWorkingCopy(
8591
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8533
            "/Completion/src/test/CompletionArrayClone.java",
8592
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic12.java");
8534
            "public class CompletionMemberType3 {\n"+
8535
            "	public class MemberException extends Exception {\n"+
8536
            "	}\n"+
8537
            "	void foo() {\n"+
8538
            "		throw new MemberE\n"+
8539
            "	}\n"+
8540
            "}");
8541
    
8542
    
8543
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8544
    String str = this.wc.getSource();
8545
    String completeBehind = "new MemberE";
8546
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8547
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8548
8593
8549
	assertResults(
8594
		String str = cu.getSource();
8550
		"CompletionMemberType3.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
8595
		String completeBehind = "pub";
8551
		requestor.getResults());
8596
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8597
		cu.codeComplete(cursorLocation, requestor);
8598
8599
		assertEquals(
8600
			"",
8601
			requestor.getResults());
8552
}
8602
}
8553
public void testCompletionAfterCase1() throws JavaModelException {
8603
public void testCompletionKeywordPublic13() throws JavaModelException {
8554
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8604
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8555
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase1.java");
8605
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic13.java");
8556
8606
8557
		String str = cu.getSource();
8607
		String str = cu.getSource();
8558
		String completeBehind = "zz";
8608
		String completeBehind = "pub";
8559
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8609
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8560
		cu.codeComplete(cursorLocation, requestor);
8610
		cu.codeComplete(cursorLocation, requestor);
8561
8611
8562
		assertEquals(
8612
		assertEquals(
8563
			"element:zzz    completion:zzz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8613
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8564
			requestor.getResults());
8614
			requestor.getResults());
8565
}
8615
}
8566
public void testCompletionAfterCase2() throws JavaModelException {
8616
public void testCompletionKeywordPublic14() throws JavaModelException {
8567
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8617
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8568
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase2.java");
8618
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic14.java");
8569
8619
8570
		String str = cu.getSource();
8620
		String str = cu.getSource();
8571
		String completeBehind = "zz";
8621
		String completeBehind = "pub";
8572
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8622
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8573
		cu.codeComplete(cursorLocation, requestor);
8623
		cu.codeComplete(cursorLocation, requestor);
8574
8624
8575
		assertEquals(
8625
		assertEquals(
8576
			"element:zzz    completion:zzz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8626
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8577
			requestor.getResults());
8627
			requestor.getResults());
8578
}
8628
}
8579
public void testCompletionToplevelType1() throws JavaModelException {
8629
public void testCompletionKeywordPublic15() throws JavaModelException {
8580
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8630
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8581
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "p3", "CompletionToplevelType1.java");
8631
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic15.java");
8582
8632
8583
		String str = cu.getSource();
8633
		String str = cu.getSource();
8584
		String completeBehind = "CompletionToplevelType1";
8634
		String completeBehind = "pub";
8585
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8635
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8586
		cu.codeComplete(cursorLocation, requestor);
8636
		cu.codeComplete(cursorLocation, requestor);
8587
8637
8588
		assertEquals(
8638
		assertEquals(
8589
			"element:CompletionToplevelType1    completion:CompletionToplevelType1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
8639
			"",
8590
			requestor.getResults());
8640
			requestor.getResults());
8591
}
8641
}
8592
public void testCompletionCatchArgumentName2() throws JavaModelException {
8642
public void testCompletionKeywordPublic16() throws JavaModelException {
8593
	Hashtable options = JavaCore.getOptions();
8643
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8594
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_ARGUMENT_PREFIXES);
8644
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic16.java");
8595
	options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,"arg"); //$NON-NLS-1$
8596
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8597
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"loc"); //$NON-NLS-1$
8598
	
8599
	JavaCore.setOptions(options);
8600
8645
8601
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8646
		String str = cu.getSource();
8602
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCatchArgumentName2.java");
8647
		String completeBehind = "pub";
8648
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8649
		cu.codeComplete(cursorLocation, requestor);
8603
8650
8604
	String str = cu.getSource();
8651
		assertEquals(
8605
	String completeBehind = "Exception ";
8652
			"",
8606
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8653
			requestor.getResults());
8607
	cu.codeComplete(cursorLocation, requestor);
8654
}
8655
public void testCompletionKeywordPublic17() throws JavaModelException {
8656
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8657
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic17.java");
8608
8658
8609
	options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,argumentPrefixPreviousValue);
8659
		String str = cu.getSource();
8610
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,localPrefixPreviousValue);
8660
		String completeBehind = "pub";
8611
	JavaCore.setOptions(options);
8661
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8662
		cu.codeComplete(cursorLocation, requestor);
8612
8663
8613
	assertEquals(
8664
		assertEquals(
8614
		"element:exception    completion:exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8665
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8615
		"element:locException    completion:locException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX+ R_NON_RESTRICTED),
8666
			requestor.getResults());
8616
		requestor.getResults());
8617
}
8667
}
8618
public void testCompletionArrayAccess1() throws JavaModelException {
8668
public void testCompletionKeywordPublic18() throws JavaModelException {
8619
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8669
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8620
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArrayAccess1.java");
8670
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic18.java");
8621
8671
8622
	String str = cu.getSource();
8672
		String str = cu.getSource();
8623
	String completeBehind = "zzz";
8673
		String completeBehind = "pub";
8624
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8674
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8625
	cu.codeComplete(cursorLocation, requestor);
8675
		cu.codeComplete(cursorLocation, requestor);
8626
8676
8627
	assertEquals(
8677
		assertEquals(
8628
		"element:zzz1    completion:zzz1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8678
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8629
		"element:zzz2    completion:zzz2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE +R_UNQUALIFIED+ R_NON_RESTRICTED),
8679
			requestor.getResults());
8630
		requestor.getResults());
8631
}
8680
}
8632
public void testCompletionVariableName3() throws JavaModelException {
8681
public void testCompletionKeywordPublic19() throws JavaModelException {
8633
	Hashtable options = JavaCore.getOptions();
8682
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8634
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8683
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPublic19.java");
8635
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"p1,p2"); //$NON-NLS-1$
8636
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8637
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"s1,s2"); //$NON-NLS-1$
8638
	
8639
	JavaCore.setOptions(options);
8640
8684
8641
	try {
8685
		String str = cu.getSource();
8686
		String completeBehind = "pub";
8687
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8688
		cu.codeComplete(cursorLocation, requestor);
8689
8690
		assertEquals(
8691
			"element:public    completion:public    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8692
			requestor.getResults());
8693
}
8694
public void testCompletionKeywordPrivate6() throws JavaModelException {
8642
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8695
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8643
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName3.java");
8696
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate6.java");
8644
	
8697
8645
		String str = cu.getSource();
8698
		String str = cu.getSource();
8646
		String completeBehind = "OneName ";
8699
		String completeBehind = "pri";
8647
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8700
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8648
		cu.codeComplete(cursorLocation, requestor);
8701
		cu.codeComplete(cursorLocation, requestor);
8649
	
8702
8650
		assertEquals(
8703
		assertEquals(
8651
			"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8704
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8652
			"element:names1    completion:names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8653
			"element:names2    completion:names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
8654
			"element:oneName    completion:oneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8655
			"element:oneNames1    completion:oneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8656
			"element:oneNames2    completion:oneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
8657
			"element:p1Name    completion:p1Name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+
8658
			"element:p1Names1    completion:p1Names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8659
			"element:p1Names2    completion:p1Names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
8660
			"element:p1OneName    completion:p1OneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+
8661
			"element:p1OneNames1    completion:p1OneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8662
			"element:p1OneNames2    completion:p1OneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
8663
			"element:p2Name    completion:p2Name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+
8664
			"element:p2Names1    completion:p2Names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8665
			"element:p2Names2    completion:p2Names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
8666
			"element:p2OneName    completion:p2OneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+
8667
			"element:p2OneNames1    completion:p2OneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
8668
			"element:p2OneNames2    completion:p2OneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX+ R_NON_RESTRICTED),
8669
			requestor.getResults());
8705
			requestor.getResults());
8670
	} finally {
8671
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8672
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8673
		JavaCore.setOptions(options);
8674
	}
8675
}
8706
}
8676
public void testCompletionVariableName4() throws JavaModelException {
8707
public void testCompletionKeywordPrivate7() throws JavaModelException {
8677
	this.wc = getWorkingCopy(
8708
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8678
            "/Completion/src/CompletionVariableName4.java",
8709
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate7.java");
8679
            "class FooBar {\n"+
8680
            "}\n"+
8681
            "public class CompletionVariableName4 {\n"+
8682
            "	void foo(){\n"+
8683
            "		FooBar the\n"+
8684
            "	}\n"+
8685
            "}");
8686
    
8687
    
8688
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8689
    String str = this.wc.getSource();
8690
    String completeBehind = "the";
8691
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8692
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8693
8710
8694
    assertResults(
8711
		String str = cu.getSource();
8695
    		"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8712
		String completeBehind = "pri";
8696
			"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}",
8713
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8714
		cu.codeComplete(cursorLocation, requestor);
8715
8716
		assertEquals(
8717
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8697
			requestor.getResults());
8718
			requestor.getResults());
8698
}
8719
}
8699
public void testCompletionVariableName5() throws JavaModelException {
8720
public void testCompletionKeywordPrivate8() throws JavaModelException {
8700
	this.wc = getWorkingCopy(
8721
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8701
            "/Completion/src/CompletionVariableName5.java",
8722
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate8.java");
8702
            "class FooBar {\n"+
8703
            "}\n"+
8704
            "public class CompletionVariableName5 {\n"+
8705
            "	void foo(){\n"+
8706
            "		FooBar thefo\n"+
8707
            "	}\n"+
8708
            "}");
8709
    
8710
    
8711
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8712
    String str = this.wc.getSource();
8713
    String completeBehind = "thefo";
8714
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8715
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8716
8723
8717
    assertResults(
8724
		String str = cu.getSource();
8718
    		"thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8725
		String completeBehind = "pri";
8719
			"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
8726
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8727
		cu.codeComplete(cursorLocation, requestor);
8728
8729
		assertEquals(
8730
			"element:private    completion:private    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8720
			requestor.getResults());
8731
			requestor.getResults());
8721
}
8732
}
8722
public void testCompletionVariableName6() throws JavaModelException {
8733
public void testCompletionKeywordPrivate9() throws JavaModelException {
8723
	this.wc = getWorkingCopy(
8734
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8724
            "/Completion/src/CompletionVariableName6.java",
8735
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate9.java");
8725
            "class FooBar {\n"+
8726
            "}\n"+
8727
            "public class CompletionVariableName6 {\n"+
8728
            "	void foo(){\n"+
8729
            "		FooBar theba\n"+
8730
            "	}\n"+
8731
            "}");
8732
    
8733
    
8734
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8735
    String str = this.wc.getSource();
8736
    String completeBehind = "theba";
8737
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8738
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8739
8736
8740
    assertResults(
8737
		String str = cu.getSource();
8741
    		"thebaFooBar[VARIABLE_DECLARATION]{thebaFooBar, null, LFooBar;, thebaFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8738
		String completeBehind = "pri";
8742
			"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
8739
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8740
		cu.codeComplete(cursorLocation, requestor);
8741
8742
		assertEquals(
8743
			"",
8743
			requestor.getResults());
8744
			requestor.getResults());
8744
}
8745
}
8745
public void testCompletionVariableName7() throws JavaModelException {
8746
public void testCompletionKeywordPrivate10() throws JavaModelException {
8746
	this.wc = getWorkingCopy(
8747
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8747
            "/Completion/src/CompletionVariableName7.java",
8748
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordPrivate10.java");
8748
            "class FooBar {\n"+
8749
            "}\n"+
8750
            "public class CompletionVariableName7 {\n"+
8751
            "	void foo(){\n"+
8752
            "		FooBar fo\n"+
8753
            "	}\n"+
8754
            "}");
8755
    
8756
    
8757
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8758
    String str = this.wc.getSource();
8759
    String completeBehind = "fo";
8760
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8761
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8762
8749
8763
    assertResults(
8750
		String str = cu.getSource();
8764
			"foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8751
		String completeBehind = "pri";
8765
			"fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
8752
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8753
		cu.codeComplete(cursorLocation, requestor);
8754
8755
		assertEquals(
8756
			"",
8766
			requestor.getResults());
8757
			requestor.getResults());
8767
}
8758
}
8768
public void testCompletionVariableName8() throws JavaModelException {
8759
public void testCompletionKeywordProtected6() throws JavaModelException {
8769
	Hashtable options = JavaCore.getOptions();
8760
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8770
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8761
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected6.java");
8771
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8772
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8773
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8774
	
8775
	JavaCore.setOptions(options);
8776
8762
8777
	try {
8763
		String str = cu.getSource();
8778
		this.wc = getWorkingCopy(
8764
		String completeBehind = "pro";
8779
	            "/Completion/src/CompletionVariableName8.java",
8765
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8780
	            "class FooBar {\n"+
8766
		cu.codeComplete(cursorLocation, requestor);
8781
	            "}\n"+
8767
8782
	            "public class CompletionVariableName8 {\n"+
8768
		assertEquals(
8783
	            "	void foo(){\n"+
8769
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8784
	            "		FooBar the\n"+
8770
			requestor.getResults());
8785
	            "	}\n"+
8786
	            "}");
8787
	    
8788
	    
8789
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8790
	    String str = this.wc.getSource();
8791
	    String completeBehind = "the";
8792
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8793
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8794
	
8795
	    assertResults(
8796
				"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8797
				"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8798
				"theBarsuf[VARIABLE_DECLARATION]{theBarsuf, null, LFooBar;, theBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
8799
				"theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}",
8800
				requestor.getResults());
8801
	} finally {
8802
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8803
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8804
		JavaCore.setOptions(options);
8805
	}
8806
}
8771
}
8807
public void testCompletionVariableName9() throws JavaModelException {
8772
public void testCompletionKeywordProtected7() throws JavaModelException {
8808
	Hashtable options = JavaCore.getOptions();
8773
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8809
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8774
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected7.java");
8810
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8811
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8812
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8813
	
8814
	JavaCore.setOptions(options);
8815
8775
8816
	try {
8776
		String str = cu.getSource();
8817
		this.wc = getWorkingCopy(
8777
		String completeBehind = "pro";
8818
	            "/Completion/src/CompletionVariableName9.java",
8778
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8819
	            "class FooBar {\n"+
8779
		cu.codeComplete(cursorLocation, requestor);
8820
	            "}\n"+
8780
8821
	            "public class CompletionVariableName9 {\n"+
8781
		assertEquals(
8822
	            "	void foo(){\n"+
8782
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8823
	            "		FooBar thefo\n"+
8783
			requestor.getResults());
8824
	            "	}\n"+
8825
	            "}");
8826
	    
8827
	    
8828
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8829
	    String str = this.wc.getSource();
8830
	    String completeBehind = "thefo";
8831
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8832
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8833
	
8834
	    assertResults(
8835
				"thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8836
				"thefoBarsuf[VARIABLE_DECLARATION]{thefoBarsuf, null, LFooBar;, thefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
8837
				"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
8838
				"theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
8839
				requestor.getResults());
8840
	} finally {
8841
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8842
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8843
		JavaCore.setOptions(options);
8844
	}
8845
}
8784
}
8846
public void testCompletionVariableName10() throws JavaModelException {
8785
public void testCompletionKeywordProtected8() throws JavaModelException {
8847
	Hashtable options = JavaCore.getOptions();
8786
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8848
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8787
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected8.java");
8849
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8850
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8851
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8852
	
8853
	JavaCore.setOptions(options);
8854
8788
8855
	try {
8789
		String str = cu.getSource();
8856
		this.wc = getWorkingCopy(
8790
		String completeBehind = "pro";
8857
	            "/Completion/src/CompletionVariableName10.java",
8791
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8858
	            "class FooBar {\n"+
8792
		cu.codeComplete(cursorLocation, requestor);
8859
	            "}\n"+
8793
8860
	            "public class CompletionVariableName10 {\n"+
8794
		assertEquals(
8861
	            "	void foo(){\n"+
8795
			"element:protected    completion:protected    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8862
	            "		FooBar fo\n"+
8796
			requestor.getResults());
8863
	            "	}\n"+
8864
	            "}");
8865
	    
8866
	    
8867
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8868
	    String str = this.wc.getSource();
8869
	    String completeBehind = "fo";
8870
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8871
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8872
	
8873
	    assertResults(
8874
				"foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
8875
				"foBarsuf[VARIABLE_DECLARATION]{foBarsuf, null, LFooBar;, foBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
8876
				"fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
8877
				"fooBarsuf[VARIABLE_DECLARATION]{fooBarsuf, null, LFooBar;, fooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
8878
				requestor.getResults());
8879
	} finally {
8880
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8881
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8882
		JavaCore.setOptions(options);
8883
	}
8884
}
8797
}
8885
public void testCompletionVariableName11() throws JavaModelException {
8798
public void testCompletionKeywordProtected9() throws JavaModelException {
8886
	Hashtable options = JavaCore.getOptions();
8799
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8887
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8800
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected9.java");
8888
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8889
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8890
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8891
	
8892
	JavaCore.setOptions(options);
8893
8801
8894
	try {
8802
		String str = cu.getSource();
8895
		this.wc = getWorkingCopy(
8803
		String completeBehind = "pro";
8896
	            "/Completion/src/CompletionVariableName11.java",
8804
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8897
	            "class FooBar {\n"+
8805
		cu.codeComplete(cursorLocation, requestor);
8898
	            "}\n"+
8806
8899
	            "public class CompletionVariableName11 {\n"+
8807
		assertEquals(
8900
	            "	void foo(){\n"+
8808
			"",
8901
	            "		FooBar pr\n"+
8809
			requestor.getResults());
8902
	            "	}\n"+
8903
	            "}");
8904
	    
8905
	    
8906
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8907
	    String str = this.wc.getSource();
8908
	    String completeBehind = "pr";
8909
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8910
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8911
	
8912
	    assertResults(
8913
				"preBar[VARIABLE_DECLARATION]{preBar, null, LFooBar;, preBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
8914
				"preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
8915
				"preBarsuf[VARIABLE_DECLARATION]{preBarsuf, null, LFooBar;, preBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX+ R_NON_RESTRICTED)+"}\n"+
8916
				"preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
8917
				requestor.getResults());
8918
	} finally {
8919
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8920
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8921
		JavaCore.setOptions(options);
8922
	}
8923
}
8810
}
8924
public void testCompletionVariableName12() throws JavaModelException {
8811
public void testCompletionKeywordProtected10() throws JavaModelException {
8925
	Hashtable options = JavaCore.getOptions();
8812
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8926
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8813
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordProtected10.java");
8927
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8928
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8929
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8930
	
8931
	JavaCore.setOptions(options);
8932
8814
8933
	try {
8815
		String str = cu.getSource();
8934
		this.wc = getWorkingCopy(
8816
		String completeBehind = "pro";
8935
	            "/Completion/src/CompletionVariableName12.java",
8817
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8936
	            "class FooBar {\n"+
8818
		cu.codeComplete(cursorLocation, requestor);
8937
	            "}\n"+
8819
8938
	            "public class CompletionVariableName12 {\n"+
8820
		assertEquals(
8939
	            "	void foo(){\n"+
8821
			"",
8940
	            "		FooBar prethe\n"+
8822
			requestor.getResults());
8941
	            "	}\n"+
8942
	            "}");
8943
	    
8944
	    
8945
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8946
	    String str = this.wc.getSource();
8947
	    String completeBehind = "prethe";
8948
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8949
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8950
	
8951
	    assertResults(
8952
				"preTheBar[VARIABLE_DECLARATION]{preTheBar, null, LFooBar;, preTheBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
8953
				"preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
8954
				"preTheBarsuf[VARIABLE_DECLARATION]{preTheBarsuf, null, LFooBar;, preTheBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
8955
				"preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
8956
				requestor.getResults());
8957
	} finally {
8958
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8959
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8960
		JavaCore.setOptions(options);
8961
	}
8962
}
8823
}
8963
public void testCompletionVariableName13() throws JavaModelException {
8824
public void testCompletionKeywordFinal18() throws JavaModelException {
8964
	Hashtable options = JavaCore.getOptions();
8825
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8965
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8826
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal18.java");
8966
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
8967
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
8968
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
8969
	
8970
	JavaCore.setOptions(options);
8971
8827
8972
	try {
8828
		String str = cu.getSource();
8973
		this.wc = getWorkingCopy(
8829
		String completeBehind = "fin";
8974
	            "/Completion/src/CompletionVariableName13.java",
8830
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8975
	            "class FooBar {\n"+
8831
		cu.codeComplete(cursorLocation, requestor);
8976
	            "}\n"+
8832
8977
	            "public class CompletionVariableName13 {\n"+
8833
		assertEquals(
8978
	            "	void foo(){\n"+
8834
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
8979
	            "		FooBar prefo\n"+
8835
			"element:finalize    completion:finalize()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8980
	            "	}\n"+
8836
			requestor.getResults());
8981
	            "}");
8982
	    
8983
	    
8984
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
8985
	    String str = this.wc.getSource();
8986
	    String completeBehind = "prefo";
8987
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8988
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
8989
	
8990
	    assertResults(
8991
				"preFoBar[VARIABLE_DECLARATION]{preFoBar, null, LFooBar;, preFoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
8992
				"preFoBarsuf[VARIABLE_DECLARATION]{preFoBarsuf, null, LFooBar;, preFoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
8993
				"preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
8994
				"preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
8995
				requestor.getResults());
8996
	} finally {
8997
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
8998
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
8999
		JavaCore.setOptions(options);
9000
	}
9001
}
8837
}
9002
public void testCompletionVariableName14() throws JavaModelException {
8838
public void testCompletionKeywordFinal10() throws JavaModelException {
9003
	Hashtable options = JavaCore.getOptions();
8839
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9004
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
8840
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal10.java");
9005
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9006
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9007
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9008
	
9009
	JavaCore.setOptions(options);
9010
8841
9011
	try {
8842
		String str = cu.getSource();
9012
		this.wc = getWorkingCopy(
8843
		String completeBehind = "fin";
9013
	            "/Completion/src/CompletionVariableName14.java",
8844
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9014
	            "class FooBar {\n"+
8845
		cu.codeComplete(cursorLocation, requestor);
9015
	            "}\n"+
8846
9016
	            "public class CompletionVariableName14 {\n"+
8847
		assertEquals(
9017
	            "	void foo(){\n"+
8848
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9018
	            "		FooBar prethefo\n"+
8849
			requestor.getResults());
9019
	            "	}\n"+
9020
	            "}");
9021
	    
9022
	    
9023
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9024
	    String str = this.wc.getSource();
9025
	    String completeBehind = "prethefo";
9026
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9027
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9028
	
9029
	    assertResults(
9030
				"preThefoBar[VARIABLE_DECLARATION]{preThefoBar, null, LFooBar;, preThefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9031
				"preThefoBarsuf[VARIABLE_DECLARATION]{preThefoBarsuf, null, LFooBar;, preThefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9032
				"preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
9033
				"preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
9034
				requestor.getResults());
9035
	} finally {
9036
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9037
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9038
		JavaCore.setOptions(options);
9039
	}
9040
}
8850
}
9041
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=128045
8851
public void testCompletionKeywordFinal11() throws JavaModelException {
9042
public void testCompletionVariableName15() throws JavaModelException {
8852
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9043
	Hashtable options = JavaCore.getOptions();
8853
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal11.java");
9044
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9045
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9046
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9047
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9048
	
9049
	JavaCore.setOptions(options);
9050
8854
9051
	try {
8855
		String str = cu.getSource();
9052
		this.wc = getWorkingCopy(
8856
		String completeBehind = "fin";
9053
	            "/Completion/src/CompletionVariableName15.java",
8857
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9054
	            "class FooBar {\n"+
8858
		cu.codeComplete(cursorLocation, requestor);
9055
	            "}\n"+
8859
9056
	            "public class CompletionVariableName15 {\n"+
8860
		assertEquals(
9057
	            "	void foo(){\n"+
8861
			"",
9058
	            "		FooBar pro\n"+
8862
			requestor.getResults());
9059
	            "	}\n"+
9060
	            "}");
9061
	    
9062
	    
9063
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9064
	    String str = this.wc.getSource();
9065
	    String completeBehind = "pro";
9066
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9067
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9068
	
9069
	    assertResults(
9070
				"proBar[VARIABLE_DECLARATION]{proBar, null, LFooBar;, proBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9071
				"proFooBar[VARIABLE_DECLARATION]{proFooBar, null, LFooBar;, proFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9072
				"proBarsuf[VARIABLE_DECLARATION]{proBarsuf, null, LFooBar;, proBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}\n"+
9073
				"proFooBarsuf[VARIABLE_DECLARATION]{proFooBarsuf, null, LFooBar;, proFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}",
9074
				requestor.getResults());
9075
	} finally {
9076
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9077
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9078
		JavaCore.setOptions(options);
9079
	}
9080
}
8863
}
9081
public void testCompletionNonEmptyToken1() throws JavaModelException {
8864
public void testCompletionKeywordFinal12() throws JavaModelException {
9082
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8865
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9083
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonEmptyToken1.java");
8866
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal12.java");
9084
8867
9085
	String str = cu.getSource();
8868
		String str = cu.getSource();
9086
	String completeBehind = "zz";
8869
		String completeBehind = "fin";
9087
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8870
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9088
	int start = cursorLocation - 2;
8871
		cu.codeComplete(cursorLocation, requestor);
9089
	int end = start + 4;
9090
	cu.codeComplete(cursorLocation, requestor);
9091
8872
9092
	assertEquals(
8873
		assertEquals(
9093
		"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8874
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9094
		requestor.getResultsWithPosition());
8875
			requestor.getResults());
9095
}
8876
}
9096
public void testCompletionEmptyToken1() throws JavaModelException {
8877
public void testCompletionKeywordFinal13() throws JavaModelException {
9097
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8878
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9098
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyToken1.java");
8879
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal13.java");
9099
8880
9100
	String str = cu.getSource();
8881
		String str = cu.getSource();
9101
	String completeBehind = "zz";
8882
		String completeBehind = "fin";
9102
	// completion is just at start of 'zz'
8883
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9103
	int cursorLocation = str.lastIndexOf(completeBehind);
8884
		cu.codeComplete(cursorLocation, requestor);
9104
	int start = cursorLocation;
9105
	int end = start + 4;
9106
	cu.codeComplete(cursorLocation, requestor);
9107
8885
9108
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9109
		assertEquals(
8886
		assertEquals(
9110
			"element:clone    completion:clone()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8887
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9111
			"element:equals    completion:equals()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8888
			requestor.getResults());
9112
			"element:finalize    completion:finalize()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8889
}
9113
			"element:foo    completion:foo()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8890
public void testCompletionKeywordFinal14() throws JavaModelException {
9114
			"element:getClass    completion:getClass()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8891
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9115
			"element:hashCode    completion:hashCode()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8892
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal14.java");
9116
			"element:notify    completion:notify()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8893
9117
			"element:notifyAll    completion:notifyAll()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8894
		String str = cu.getSource();
9118
			"element:toString    completion:toString()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8895
		String completeBehind = "fin";
9119
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8896
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9120
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8897
		cu.codeComplete(cursorLocation, requestor);
9121
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8898
9122
			"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9123
			requestor.getResultsWithPosition());
9124
	} else {
9125
		assertEquals(
8899
		assertEquals(
9126
			"element:CompletionEmptyToken1    completion:CompletionEmptyToken1    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8900
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
9127
			"element:clone    completion:clone()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8901
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
9128
			"element:equals    completion:equals()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8902
			requestor.getResults());
9129
			"element:finalize    completion:finalize()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9130
			"element:foo    completion:foo()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9131
			"element:getClass    completion:getClass()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9132
			"element:hashCode    completion:hashCode()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9133
			"element:notify    completion:notify()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9134
			"element:notifyAll    completion:notifyAll()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9135
			"element:toString    completion:toString()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9136
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9137
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9138
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9139
			"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9140
			requestor.getResultsWithPosition());
9141
	}
9142
}
8903
}
9143
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=100808
8904
public void testCompletionKeywordFinal15() throws JavaModelException {
9144
public void testCompletionEmptyToken2() throws JavaModelException {
8905
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9145
    this.wc = getWorkingCopy(
8906
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal15.java");
9146
            "/Completion/src/testCompletionEmptyToken2/Test.java",
9147
            "package testCompletionEmptyToken2.");
9148
    
9149
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true);
9150
    
9151
    String str = this.wc.getSource();
9152
    String completeBehind = "testCompletionEmptyToken2.";
9153
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9154
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9155
8907
9156
    int start = str.lastIndexOf(completeBehind);
8908
		String str = cu.getSource();
9157
    int end = start + completeBehind.length();
8909
		String completeBehind = "fin";
9158
    
8910
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9159
    assertResults(
8911
		cu.codeComplete(cursorLocation, requestor);
9160
            "expectedTypesSignatures=null\n"+
8912
9161
            "expectedTypesKeys=null",
8913
		assertEquals(
9162
            requestor.getContext());
8914
			"",
9163
    
8915
			requestor.getResults());
9164
	assertResults(
9165
            "testCompletionEmptyToken2[PACKAGE_REF]{testCompletionEmptyToken2, testCompletionEmptyToken2, null, null, null, ["+start+", "+end+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
9166
            requestor.getResults());
9167
}
8916
}
9168
public void testCompletionFindSecondaryType1() throws JavaModelException {
8917
public void testCompletionKeywordFinal16() throws JavaModelException {
9169
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8918
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9170
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindSecondaryType1.java");
8919
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal16.java");
9171
8920
9172
	String str = cu.getSource();
8921
		String str = cu.getSource();
9173
	String completeBehind = "/**/Secondary";
8922
		String completeBehind = "fin";
9174
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8923
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9175
	cu.codeComplete(cursorLocation, requestor);
8924
		cu.codeComplete(cursorLocation, requestor);
9176
8925
9177
	assertEquals(
8926
		assertEquals(
9178
		"element:SecondaryType1    completion:SecondaryType1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8927
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
9179
		"element:SecondaryType2    completion:SecondaryType2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
8928
			"element:finalize    completion:protected void finalize() throws Throwable    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE+ R_NON_RESTRICTED),
9180
		requestor.getResults());
8929
			requestor.getResults());
9181
}
8930
}
9182
public void testCompletionLocalType1() throws JavaModelException {
8931
public void testCompletionKeywordFinal17() throws JavaModelException {
9183
	this.workingCopies = new ICompilationUnit[1];
8932
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9184
	this.workingCopies[0] = getWorkingCopy(
8933
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFinal17.java");
9185
		"/Completion/src/CompletionLocalType1.java",
9186
		"public class CompletionLocalType1 {\n" +
9187
		"	void foo() {\n" +
9188
		"		class ZZZZ {\n" +
9189
		"			ZZZ\n" +
9190
		"		}\n" +
9191
		"	}\n" +
9192
		"}");
9193
	
9194
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9195
	String str = this.workingCopies[0].getSource();
9196
	String completeBehind = "ZZZ";
9197
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9198
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9199
8934
9200
	assertResults(
8935
		String str = cu.getSource();
9201
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, LZZZZ;, ()V, ZZZ, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+
8936
		String completeBehind = "fin";
9202
			"ZZZZ[TYPE_REF]{ZZZZ, , LZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}",
8937
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8938
		cu.codeComplete(cursorLocation, requestor);
8939
8940
		assertEquals(
8941
			"element:final    completion:final    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9203
			requestor.getResults());
8942
			requestor.getResults());
9204
}
8943
}
9205
public void testCompletionType1() throws JavaModelException {
8944
public void testCompletionKeywordAbstract9() throws JavaModelException {
9206
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8945
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9207
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionType1.java");
8946
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract9.java");
9208
8947
9209
	String str = cu.getSource();
8948
		String str = cu.getSource();
9210
	String completeBehind = "CT1";
8949
		String completeBehind = "abs";
9211
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8950
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9212
	cu.codeComplete(cursorLocation, requestor);
8951
		cu.codeComplete(cursorLocation, requestor);
9213
8952
9214
	assertEquals(
8953
		assertEquals(
9215
		"element:CT1    completion:CT1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
8954
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9216
		"element:CT1    completion:q2.CT1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
8955
			requestor.getResults());
9217
		requestor.getResults());
9218
}
8956
}
9219
public void testCompletionQualifiedAllocationType1() throws JavaModelException {
8957
public void testCompletionKeywordAbstract10() throws JavaModelException {
9220
	this.wc = getWorkingCopy(
8958
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9221
            "/Completion/src/CompletionQualifiedAllocationType1.java",
8959
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract10.java");
9222
            "public class CompletionQualifiedAllocationType1 {\n"+
8960
9223
            "	public class YYY {\n"+
8961
		String str = cu.getSource();
9224
            "	}\n"+
8962
		String completeBehind = "abs";
9225
            "	void foo(){\n"+
8963
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9226
            "		this.new YYY\n"+
8964
		cu.codeComplete(cursorLocation, requestor);
9227
            "	}\n"+
9228
            "}");
9229
    
9230
    
9231
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9232
    String str = this.wc.getSource();
9233
    String completeBehind = "YYY";
9234
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9235
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9236
8965
9237
    assertResults(
8966
		assertEquals(
9238
		"CompletionQualifiedAllocationType1.YYY[TYPE_REF]{YYY, , LCompletionQualifiedAllocationType1$YYY;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
8967
			"",
9239
		requestor.getResults());
8968
			requestor.getResults());
9240
}
8969
}
9241
public void testCompletionClassLiteralAfterAnonymousType1() throws JavaModelException {
8970
public void testCompletionKeywordAbstract11() throws JavaModelException {
9242
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8971
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9243
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionClassLiteralAfterAnonymousType1.java");
8972
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract11.java");
9244
8973
9245
	String str = cu.getSource();
8974
		String str = cu.getSource();
9246
	String completeBehind = "double.";
8975
		String completeBehind = "abs";
9247
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8976
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9248
	cu.codeComplete(cursorLocation, requestor);
8977
		cu.codeComplete(cursorLocation, requestor);
9249
8978
9250
	assertEquals(
8979
		assertEquals(
9251
		"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
8980
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9252
		requestor.getResults());
8981
			requestor.getResults());
9253
}
8982
}
9254
public void testCompletionArraysCloneMethod() throws JavaModelException {
8983
public void testCompletionKeywordAbstract12() throws JavaModelException {
9255
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
8984
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9256
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArraysCloneMethod.java");
8985
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract12.java");
9257
8986
9258
	String str = cu.getSource();
8987
		String str = cu.getSource();
9259
	String completeBehind = ".cl";
8988
		String completeBehind = "abs";
9260
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
8989
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9261
	cu.codeComplete(cursorLocation, requestor);
8990
		cu.codeComplete(cursorLocation, requestor);
9262
8991
9263
	assertEquals(
8992
		assertEquals(
9264
		"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
8993
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9265
		requestor.getResults());
8994
			requestor.getResults());
9266
}
8995
}
9267
public void testCompletionAbstractMethod1() throws JavaModelException {
8996
public void testCompletionKeywordAbstract13() throws JavaModelException {
9268
	this.wc = getWorkingCopy(
8997
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9269
            "/Completion/src/CompletionAbstractMethod1.java",
8998
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract13.java");
9270
            "public class CompletionAbstractMethod1 {\n" +
9271
            "	abstract class A {\n" +
9272
            "		abstract void foo();\n" +
9273
            "	}\n" +
9274
            "	class B extends A {\n" +
9275
            "		void foo{} {}\n" +
9276
            "		void bar() {\n" +
9277
            "			super.fo\n" +
9278
            "		}\n" +
9279
            "	}\n" +
9280
            "}");
9281
    
9282
    
9283
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9284
    String str = this.wc.getSource();
9285
    String completeBehind = "fo";
9286
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9287
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9288
8999
9289
    assertResults(
9000
		String str = cu.getSource();
9290
            "",
9001
		String completeBehind = "abs";
9291
            requestor.getResults());
9002
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9292
}
9003
		cu.codeComplete(cursorLocation, requestor);
9293
public void testCompletionAbstractMethod2() throws JavaModelException {
9294
	this.wc = getWorkingCopy(
9295
            "/Completion/src/CompletionAbstractMethod2.java",
9296
            "public class CompletionAbstractMethod2 {\n" +
9297
            "	abstract class A {\n" +
9298
            "		abstract void foo();\n" +
9299
            "	}\n" +
9300
            "	class B extends A {\n" +
9301
            "		void foo{} {}\n" +
9302
            "		void bar() {\n" +
9303
            "			this.fo\n" +
9304
            "		}\n" +
9305
            "	}\n" +
9306
            "}");
9307
    
9308
    
9309
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9310
    String str = this.wc.getSource();
9311
    String completeBehind = "fo";
9312
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9313
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9314
9004
9315
    assertResults(
9005
		assertEquals(
9316
           "foo[METHOD_REF]{foo(), LCompletionAbstractMethod2$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED) + "}",
9006
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9317
           requestor.getResults());
9007
			requestor.getResults());
9318
}
9008
}
9319
public void testCompletionAbstractMethod3() throws JavaModelException {
9009
public void testCompletionKeywordAbstract14() throws JavaModelException {
9320
	this.wc = getWorkingCopy(
9010
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9321
            "/Completion/src/CompletionAbstractMethod3.java",
9011
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract14.java");
9322
            "public class CompletionAbstractMethod3 {\n" +
9323
            "	abstract class A {\n" +
9324
            "		abstract void foo();\n" +
9325
            "	}\n" +
9326
            "	class B extends A {\n" +
9327
            "		void bar() {\n" +
9328
            "			this.fo\n" +
9329
            "		}\n" +
9330
            "	}\n" +
9331
            "}");
9332
    
9333
    
9334
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9335
    String str = this.wc.getSource();
9336
    String completeBehind = "fo";
9337
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9338
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9339
9012
9340
    assertResults(
9013
		String str = cu.getSource();
9341
           "foo[METHOD_REF]{foo(), LCompletionAbstractMethod3$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
9014
		String completeBehind = "abs";
9342
           requestor.getResults());
9015
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9343
}
9016
		cu.codeComplete(cursorLocation, requestor);
9344
public void testCompletionAbstractMethod4() throws JavaModelException {
9345
	this.wc = getWorkingCopy(
9346
            "/Completion/src/CompletionAbstractMethod4.java",
9347
            "public class CompletionAbstractMethod1 {\n" +
9348
            "	class A {\n" +
9349
            "		void foo(){}\n" +
9350
            "	}\n" +
9351
            "	abstract class B extends A {\n" +
9352
            "		abstract void foo();\n" +
9353
            "	}\n" +
9354
            "	class C extends B {\n" +
9355
            "		void foo{} {}\n" +
9356
            "		void bar() {\n" +
9357
            "			super.fo\n" +
9358
            "		}\n" +
9359
            "	}\n" +
9360
            "}");
9361
    
9362
    
9363
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9364
    String str = this.wc.getSource();
9365
    String completeBehind = "fo";
9366
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9367
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9368
9017
9369
    assertResults(
9018
		assertEquals(
9370
           "",
9019
			"",
9371
           requestor.getResults());
9020
			requestor.getResults());
9372
}
9021
}
9373
public void testCompletionStaticMethodDeclaration1() throws JavaModelException {
9022
public void testCompletionKeywordAbstract15() throws JavaModelException {
9374
	ICompilationUnit aType = null;
9023
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9375
	try {
9024
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract15.java");
9376
		aType = getWorkingCopy(
9025
9377
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9026
		String str = cu.getSource();
9378
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9027
		String completeBehind = "abs";
9379
	            "	public static void foo(){}\n"+
9028
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9380
	            "	public void foo0(){}\n"+
9029
		cu.codeComplete(cursorLocation, requestor);
9381
	            "}");
9030
9382
		
9031
		assertEquals(
9383
		this.wc = getWorkingCopy(
9032
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9384
	            "/Completion/src/CompletionStaticMethodDeclaration1.java",
9033
			requestor.getResults());
9385
	            "public class CompletionStaticMethodDeclaration1 extends TypeWithAMethodAndAStaticMethod {\n"+
9386
	            "	foo\n"+
9387
	            "}");
9388
	    
9389
	    
9390
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9391
	    String str = this.wc.getSource();
9392
	    String completeBehind = "foo";
9393
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9394
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9395
	
9396
		assertResults(
9397
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9398
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9399
				requestor.getResults());
9400
	} finally {
9401
		if(aType != null) {
9402
			aType.discardWorkingCopy();
9403
		}
9404
	}
9405
}
9034
}
9406
public void testCompletionStaticMethodDeclaration2() throws JavaModelException {
9035
public void testCompletionKeywordAbstract16() throws JavaModelException {
9407
	ICompilationUnit aType = null;
9036
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9408
	try {
9037
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordAbstract16.java");
9409
		aType = getWorkingCopy(
9038
9410
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9039
		String str = cu.getSource();
9411
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9040
		String completeBehind = "abs";
9412
	            "	public static void foo(){}\n"+
9041
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9413
	            "	public void foo0(){}\n"+
9042
		cu.codeComplete(cursorLocation, requestor);
9414
	            "}");
9043
9415
			
9044
		assertEquals(
9416
		this.wc = getWorkingCopy(
9045
			"element:abstract    completion:abstract    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9417
	            "/Completion/src/CompletionStaticMethodDeclaration2.java",
9046
			requestor.getResults());
9418
	            "public class CompletionStaticMethodDeclaration2 {\n" +
9419
	            "	class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" +
9420
	            "		foo\n" +
9421
	            "	}\n" +
9422
	            "}");
9423
	    
9424
	    
9425
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9426
	    String str = this.wc.getSource();
9427
	    String completeBehind = "foo";
9428
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9429
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9430
	
9431
		assertResults(
9432
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration2$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9433
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9434
				requestor.getResults());
9435
	} finally {
9436
		if(aType != null) {
9437
			aType.discardWorkingCopy();
9438
		}
9439
	}
9440
}
9047
}
9441
public void testCompletionStaticMethodDeclaration3() throws JavaModelException {
9048
public void testCompletionKeywordTrue3() throws JavaModelException {
9442
	ICompilationUnit aType = null;
9049
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9443
	try {
9050
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue3.java");
9444
		aType = getWorkingCopy(
9051
9445
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9052
		String str = cu.getSource();
9446
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9053
		String completeBehind = "tru";
9447
	            "	public static void foo(){}\n"+
9054
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9448
	            "	public void foo0(){}\n"+
9055
		cu.codeComplete(cursorLocation, requestor);
9449
	            "}");
9056
9450
			
9057
		assertEquals(
9451
		this.wc = getWorkingCopy(
9058
			"",
9452
	            "/Completion/src/CompletionStaticMethodDeclaration3.java",
9059
			requestor.getResults());
9453
	            "public class CompletionStaticMethodDeclaration3 {\n" +
9454
	            "	static class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" +
9455
	            "		foo\n" +
9456
	            "	}\n" +
9457
	            "}");
9458
	    
9459
	    
9460
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9461
	    String str = this.wc.getSource();
9462
	    String completeBehind = "foo";
9463
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9464
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9465
	
9466
		assertResults(
9467
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration3$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9468
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9469
				requestor.getResults());
9470
	} finally {
9471
		if(aType != null) {
9472
			aType.discardWorkingCopy();
9473
		}
9474
	}
9475
}
9060
}
9476
public void testCompletionStaticMethodDeclaration4() throws JavaModelException {
9061
public void testCompletionKeywordTrue4() throws JavaModelException {
9477
	ICompilationUnit aType = null;
9062
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9478
	try {
9063
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordTrue4.java");
9479
		aType = getWorkingCopy(
9064
9480
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9065
		String str = cu.getSource();
9481
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9066
		String completeBehind = "tru";
9482
	            "	public static void foo(){}\n"+
9067
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9483
	            "	public void foo0(){}\n"+
9068
		cu.codeComplete(cursorLocation, requestor);
9484
	            "}");
9069
9485
			
9070
		assertEquals(
9486
		this.wc = getWorkingCopy(
9071
			"element:true    completion:true    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
9487
	            "/Completion/src/CompletionStaticMethodDeclaration4.java",
9072
			requestor.getResults());
9488
	            "public class CompletionStaticMethodDeclaration4 {\n" +
9489
	            "	void bar() {\n" +
9490
	            "		class Local1 extends TypeWithAMethodAndAStaticMethod {\n" +
9491
	            "			foo\n" +
9492
	            "		}\n" +
9493
	            "	}\n" +
9494
	            "}");
9495
	    
9496
	    
9497
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9498
	    String str = this.wc.getSource();
9499
	    String completeBehind = "foo";
9500
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9501
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9502
	
9503
		assertResults(
9504
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9505
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9506
				requestor.getResults());
9507
	} finally {
9508
		if(aType != null) {
9509
			aType.discardWorkingCopy();
9510
		}
9511
	}
9512
}
9073
}
9513
public void testCompletionStaticMethodDeclaration5() throws JavaModelException {
9074
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615
9514
	ICompilationUnit aType = null;
9075
public void testCompletionKeywordTrue5() throws JavaModelException {
9515
	try {
9076
	this.wc = getWorkingCopy(
9516
		aType = getWorkingCopy(
9077
			"/Completion/src/test/CompletionKeywordTrue5.java",
9517
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9078
			"package test;\n" +
9518
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9079
			"public class CompletionKeywordTrue5 {\n" +
9519
	            "	public static void foo(){}\n"+
9080
			"  public void foo() {\n" +
9520
	            "	public void foo0(){}\n"+
9081
			"    boolean var;\n" +
9521
	            "}");
9082
			"    var = tr\n" +
9522
			
9083
			"  }\n" +
9523
		this.wc = getWorkingCopy(
9084
			"}");
9524
	            "/Completion/src/CompletionStaticMethodDeclaration5.java",
9525
	            "public class CompletionStaticMethodDeclaration5 {\n"+
9526
	            "	void bar() {\n"+
9527
	            "		static class Local1 extends TypeWithAMethodAndAStaticMethod {\n"+
9528
	            "			foo\n"+
9529
	            "		}\n"+
9530
	            "	}\n"+
9531
	            "}");
9532
	    
9533
	    
9534
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9535
	    String str = this.wc.getSource();
9536
	    String completeBehind = "foo";
9537
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9538
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9539
	
9085
	
9540
		assertResults(
9541
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9542
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9543
				requestor.getResults());
9544
	} finally {
9545
		if(aType != null) {
9546
			aType.discardWorkingCopy();
9547
		}
9548
	}
9549
}
9550
public void testCompletionStaticMethodDeclaration6() throws JavaModelException {
9551
	ICompilationUnit aType = null;
9552
	try {
9553
		aType = getWorkingCopy(
9554
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9555
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9556
	            "	public static void foo(){}\n"+
9557
	            "	public void foo0(){}\n"+
9558
	            "}");
9559
			
9560
		this.wc = getWorkingCopy(
9561
	            "/Completion/src/CompletionStaticMethodDeclaration6.java",
9562
	            "public class CompletionStaticMethodDeclaration6 {\n"+
9563
	            "	void bar() {\n"+
9564
	            "		new TypeWithAMethodAndAStaticMethod() {\n"+
9565
	            "			foo\n"+
9566
	            "		};\n"+
9567
	            "	}\n"+
9568
	            "}");
9569
	    
9570
	    
9571
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9572
	    String str = this.wc.getSource();
9573
	    String completeBehind = "foo";
9574
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9575
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9576
	
9086
	
9577
		assertResults(
9087
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9578
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9088
	String str = this.wc.getSource();
9579
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
9089
	String completeBehind = "tr";
9580
				requestor.getResults());
9090
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9581
	} finally {
9091
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9582
		if(aType != null) {
9092
9583
			aType.discardWorkingCopy();
9093
	assertResults(
9584
		}
9094
			"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}",
9585
	}
9095
			requestor.getResults());
9586
}
9096
}
9587
public void testCompletionStaticMethod1() throws JavaModelException {
9097
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615
9588
	ICompilationUnit aType = null;
9098
public void testCompletionKeywordTrue6() throws JavaModelException {
9589
	try {
9099
	this.wc = getWorkingCopy(
9590
		aType = getWorkingCopy(
9100
			"/Completion/src/test/CompletionKeywordTrue6.java",
9591
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
9101
			"package test;\n" +
9592
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
9102
			"public class CompletionKeywordTrue6 {\n" +
9593
	            "	public static void foo(){}\n"+
9103
			"  public void foo() {\n" +
9594
	            "	public void foo0(){}\n"+
9104
			"    boolean var;\n" +
9595
	            "}");
9105
			"    var = \n" +
9596
			
9106
			"  }\n" +
9597
		this.wc = getWorkingCopy(
9107
			"}");
9598
	            "/Completion/src/CompletionStaticMethod1.java",
9108
	
9599
	            "public class CompletionStaticMethod1 extends TypeWithAMethodAndAStaticMethod {\n"+
9600
	            "	void bar(){\n"+
9601
	            "		new TypeWithAMethodAndAStaticMethod(){\n"+
9602
	            "			class Inner1 extends TypeWithAMethodAndAStaticMethod {\n"+
9603
	            "				void bar(){\n"+
9604
	            "					foo\n"+
9605
	            "				}\n"+
9606
	            "			}\n"+
9607
	            "		};\n"+
9608
	            "	}\n"+
9609
	            "	\n"+
9610
	            "}");
9611
	    
9612
	    
9613
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9614
	    String str = this.wc.getSource();
9615
	    String completeBehind = "foo";
9616
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9617
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9618
	
9109
	
9110
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9111
	String str = this.wc.getSource();
9112
	String completeBehind = "var = ";
9113
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9114
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9115
9116
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9619
		assertResults(
9117
		assertResults(
9620
				"foo0[METHOD_REF]{CompletionStaticMethod1.this.foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
9118
				"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9621
				"foo0[METHOD_REF]{foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}\n" +
9119
				"finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9622
				"foo[METHOD_REF]{CompletionStaticMethod1.foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" +
9120
				"foo[METHOD_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9623
				"foo[METHOD_REF]{foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
9121
				"getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9122
				"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9123
				"notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9124
				"notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9125
				"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9126
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9127
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9128
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9129
				"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
9130
				"var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
9131
				"false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+
9132
				"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}",
9133
				requestor.getResults());
9134
	} else {
9135
		assertResults(
9136
				"CompletionKeywordTrue6[TYPE_REF]{CompletionKeywordTrue6, test, Ltest.CompletionKeywordTrue6;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9137
				"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, clone, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9138
				"finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, finalize, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9139
				"foo[METHOD_REF]{foo(), Ltest.CompletionKeywordTrue6;, ()V, foo, null, " +(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9140
				"getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, getClass, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9141
				"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9142
				"notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, notify, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9143
				"notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, notifyAll, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9144
				"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9145
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, wait, (millis, nanos), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9146
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, wait, (millis), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9147
				"wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, wait, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9148
				"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
9149
				"var[LOCAL_VARIABLE_REF]{var, null, Z, var, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n"+
9150
				"false[KEYWORD]{false, null, null, false, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED)+"}\n"+
9151
				"true[KEYWORD]{true, null, null, true, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_TRUE_OR_FALSE + R_NON_RESTRICTED) + "}",
9624
				requestor.getResults());
9152
				requestor.getResults());
9625
	} finally {
9626
		if(aType != null) {
9627
			aType.discardWorkingCopy();
9628
		}
9629
	}
9153
	}
9630
}
9154
}
9631
public void testCompletionAfterSwitch() throws JavaModelException {
9155
public void testCompletionKeywordFalse3() throws JavaModelException {
9632
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9156
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9633
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSwitch.java");
9157
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse3.java");
9634
9158
9635
	String str = cu.getSource();
9159
		String str = cu.getSource();
9636
	String completeBehind = "bar";
9160
		String completeBehind = "fal";
9637
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9161
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9638
	cu.codeComplete(cursorLocation, requestor);
9162
		cu.codeComplete(cursorLocation, requestor);
9639
9163
9640
	assertEquals(
9164
		assertEquals(
9641
			"element:bar    completion:bar()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME+ R_NON_RESTRICTED),
9165
			"",
9642
			requestor.getResults());
9166
			requestor.getResults());
9643
}
9167
}
9644
public void testCompletionAfterSupercall1() throws JavaModelException {
9168
public void testCompletionKeywordFalse4() throws JavaModelException {
9645
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9169
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9646
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSupercall1.java");
9170
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordFalse4.java");
9647
9171
9648
	String str = cu.getSource();
9172
		String str = cu.getSource();
9649
	String completeBehind = "super.foo";
9173
		String completeBehind = "fal";
9650
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9174
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9651
	cu.codeComplete(cursorLocation, requestor);
9175
		cu.codeComplete(cursorLocation, requestor);
9652
9176
9653
	assertEquals(
9177
		assertEquals(
9654
			"element:foo    completion:foo()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED),
9178
			"element:false    completion:false    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
9655
			requestor.getResults());
9179
			requestor.getResults());
9656
}
9180
}
9657
public void testCompletionPackageAndClass1() throws JavaModelException {
9181
public void testCompletionKeywordNull3() throws JavaModelException {
9658
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9182
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9659
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Qla3.java");
9183
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull3.java");
9660
9184
9661
	String str = cu.getSource();
9185
		String str = cu.getSource();
9662
	String completeBehind = "z1.z2.ql";
9186
		String completeBehind = "nul";
9663
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9187
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9664
	cu.codeComplete(cursorLocation, requestor);
9188
		cu.codeComplete(cursorLocation, requestor);
9665
9189
9666
	assertEquals(
9190
		assertEquals(
9667
			"element:Qla1    completion:z1.z2.Qla1    relevance:" + (R_DEFAULT + R_INTERESTING + R_QUALIFIED + R_NON_RESTRICTED) + "\n" +
9191
			"",
9668
			"element:qla2    completion:z1.z2.qla2    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "\n" +
9669
			"element:z1.z2.qla0    completion:z1.z2.qla0    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED+ R_NON_RESTRICTED),
9670
			requestor.getResults());
9192
			requestor.getResults());
9671
}
9193
}
9672
public void testCompletionPackageAndClass2() throws JavaModelException {
9194
public void testCompletionKeywordNull4() throws JavaModelException {
9673
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9195
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9674
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Wla.java");
9196
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordNull4.java");
9675
9197
9676
	String str = cu.getSource();
9198
		String str = cu.getSource();
9677
	String completeBehind = "z1.z2.qla0.";
9199
		String completeBehind = "nul";
9678
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9200
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9679
	cu.codeComplete(cursorLocation, requestor);
9201
		cu.codeComplete(cursorLocation, requestor);
9680
9202
9681
	assertEquals(
9203
		assertEquals(
9682
			"element:Qla3    completion:Qla3    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
9204
			"element:null    completion:null    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9683
			"element:Qla4    completion:Qla4    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
9684
			"element:Wla    completion:Wla    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9685
			requestor.getResults());
9205
			requestor.getResults());
9686
}
9206
}
9687
public void testCompletionNonStaticFieldRelevance() throws JavaModelException {
9207
public void testCompletionKeywordInstanceof4() throws JavaModelException {
9688
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9208
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9689
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonStaticFieldRelevance.java");
9209
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof4.java");
9690
9210
9691
	String str = cu.getSource();
9211
		String str = cu.getSource();
9692
	String completeBehind = "var.Ii";
9212
		String completeBehind = "ins";
9693
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9213
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9694
	cu.codeComplete(cursorLocation, requestor);
9214
		cu.codeComplete(cursorLocation, requestor);
9695
9215
9696
	assertEquals(
9216
		assertEquals(
9697
			"element:Ii0    completion:Ii0    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
9217
			"element:instanceof    completion:instanceof    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9698
			"element:ii1    completion:ii1    relevance:" + (R_DEFAULT + R_INTERESTING + R_NON_STATIC+ R_NON_RESTRICTED),
9699
			requestor.getResults());
9218
			requestor.getResults());
9700
}
9219
}
9701
public void testCompletionInsideStaticMethod() throws JavaModelException {
9220
public void testCompletionKeywordInstanceof5() throws JavaModelException {
9702
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9221
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9703
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInsideStaticMethod.java");
9222
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof5.java");
9704
9223
9705
	String str = cu.getSource();
9224
		String str = cu.getSource();
9706
	String completeBehind = "doT";
9225
		String completeBehind = "ins";
9707
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9226
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9708
	cu.codeComplete(cursorLocation, requestor);
9227
		cu.codeComplete(cursorLocation, requestor);
9709
9228
9710
	assertEquals(
9229
		assertEquals(
9711
			"element:doTheThing    completion:doTheThing()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9230
			"",
9712
			requestor.getResults());
9231
			requestor.getResults());
9713
}
9232
}
9714
/*
9233
public void testCompletionKeywordInstanceof6() throws JavaModelException {
9715
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65737
9234
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9716
 */
9235
		ICompilationUnit cu= getCompilationUnit("Completion", "src2", "", "CompletionKeywordInstanceof6.java");
9717
public void testCompletion2InterfacesWithSameMethod() throws JavaModelException {
9718
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9719
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "Completion2InterfacesWithSameMethod.java");
9720
9236
9721
	String str = cu.getSource();
9237
		String str = cu.getSource();
9722
	String completeBehind = "var.meth";
9238
		String completeBehind = "ins";
9723
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9239
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9724
	cu.codeComplete(cursorLocation, requestor);
9240
		cu.codeComplete(cursorLocation, requestor);
9725
9241
9726
	assertEquals(
9242
		assertEquals(
9727
			"element:method    completion:method()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
9243
			"",
9728
			requestor.getResults());
9244
			requestor.getResults());
9729
}
9245
}
9730
/*
9246
public void testCompletionMemberType2() throws JavaModelException {
9731
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66570
9247
	this.wc = getWorkingCopy(
9732
 */
9248
            "/Completion/src/test/CompletionMemberType2.java",
9733
public void testCompletionExactNameCaseInsensitive() throws JavaModelException {
9249
            "public class CompletionMemberType2 {\n"+
9734
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9250
            "	public class MemberException extends Exception {\n"+
9735
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExactNameCaseInsensitive.java");
9251
            "	}\n"+
9736
9252
            "	void foo() {\n"+
9737
	String str = cu.getSource();
9253
            "		throw new \n"+
9738
	String completeBehind = "(compleTionexactnamecaseInsensitive";
9254
            "	}\n"+
9739
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9255
            "}");
9740
	cu.codeComplete(cursorLocation, requestor);
9256
    
9257
    
9258
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9259
    String str = this.wc.getSource();
9260
    String completeBehind = "new ";
9261
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9262
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9741
9263
9742
	assertEquals(
9264
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9743
			"element:CompletionExactNameCaseInsensitive    completion:CompletionExactNameCaseInsensitive    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+ "\n" +
9265
		assertResults(
9744
			"element:CompletionExactNameCaseInsensitivePlus    completion:CompletionExactNameCaseInsensitivePlus    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
9266
			"",
9267
			requestor.getResults());
9268
	} else {
9269
		assertResults(
9270
			"CompletionMemberType2[TYPE_REF]{CompletionMemberType2, test, Ltest.CompletionMemberType2;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n"+
9271
			"CompletionMemberType2.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType2$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION+ R_NON_RESTRICTED)+"}",
9745
			requestor.getResults());
9272
			requestor.getResults());
9273
	}
9746
}
9274
}
9747
/*
9275
public void testCompletionMemberType3() throws JavaModelException {
9748
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66908
9276
	this.wc = getWorkingCopy(
9749
 */
9277
            "/Completion/src/test/CompletionArrayClone.java",
9750
public void testCompletionSameClass() throws JavaModelException {
9278
            "public class CompletionMemberType3 {\n"+
9751
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9279
            "	public class MemberException extends Exception {\n"+
9752
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSameClass.java");
9280
            "	}\n"+
9281
            "	void foo() {\n"+
9282
            "		throw new MemberE\n"+
9283
            "	}\n"+
9284
            "}");
9285
    
9286
    
9287
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9288
    String str = this.wc.getSource();
9289
    String completeBehind = "new MemberE";
9290
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9291
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9753
9292
9754
	String str = cu.getSource();
9293
	assertResults(
9755
	String completeBehind = "(CompletionSameClas";
9294
		"CompletionMemberType3.MemberException[TYPE_REF]{MemberException, test, Ltest.CompletionMemberType3$MemberException;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXCEPTION+ R_UNQUALIFIED + R_NON_RESTRICTED) +"}",
9756
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9295
		requestor.getResults());
9757
	cu.codeComplete(cursorLocation, requestor);
9296
}
9297
public void testCompletionAfterCase1() throws JavaModelException {
9298
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9299
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase1.java");
9758
9300
9759
	assertEquals(
9301
		String str = cu.getSource();
9760
			"element:CompletionSameClass    completion:CompletionSameClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
9302
		String completeBehind = "zz";
9303
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9304
		cu.codeComplete(cursorLocation, requestor);
9305
9306
		assertEquals(
9307
			"element:zzz    completion:zzz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9761
			requestor.getResults());
9308
			requestor.getResults());
9762
}
9309
}
9763
public void testCompletionBasicPackage1() throws JavaModelException {
9310
public void testCompletionAfterCase2() throws JavaModelException {
9764
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9311
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9765
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPackage1.java");
9312
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterCase2.java");
9766
9313
9767
	String str = cu.getSource();
9314
		String str = cu.getSource();
9768
	String completeBehind = "java.lan";
9315
		String completeBehind = "zz";
9769
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9316
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9770
	cu.codeComplete(cursorLocation, requestor);
9317
		cu.codeComplete(cursorLocation, requestor);
9771
9318
9772
	assertResults(
9319
		assertEquals(
9773
			"java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "}",
9320
			"element:zzz    completion:zzz    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9774
			requestor.getResults());
9321
			requestor.getResults());
9775
}
9322
}
9776
public void testCompletionBasicType1() throws JavaModelException {
9323
public void testCompletionToplevelType1() throws JavaModelException {
9777
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9324
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9778
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicType1.java");
9325
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "p3", "CompletionToplevelType1.java");
9779
9326
9780
	String str = cu.getSource();
9327
		String str = cu.getSource();
9781
	String completeBehind = "Objec";
9328
		String completeBehind = "CompletionToplevelType1";
9782
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
9329
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9783
	cu.codeComplete(cursorLocation, requestor);
9330
		cu.codeComplete(cursorLocation, requestor);
9784
9331
9785
	assertResults(
9332
		assertEquals(
9786
			"Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9333
			"element:CompletionToplevelType1    completion:CompletionToplevelType1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
9787
			requestor.getResults());
9334
			requestor.getResults());
9788
}
9335
}
9789
public void testCompletionBasicField1() throws JavaModelException {
9336
public void testCompletionCatchArgumentName2() throws JavaModelException {
9790
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9337
	Hashtable options = JavaCore.getOptions();
9791
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicField1.java");
9338
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_ARGUMENT_PREFIXES);
9339
	options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,"arg"); //$NON-NLS-1$
9340
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9341
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"loc"); //$NON-NLS-1$
9342
	
9343
	JavaCore.setOptions(options);
9344
9345
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9346
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionCatchArgumentName2.java");
9792
9347
9793
	String str = cu.getSource();
9348
	String str = cu.getSource();
9794
	String completeBehind = "zzvar";
9349
	String completeBehind = "Exception ";
9795
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9350
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9796
	cu.codeComplete(cursorLocation, requestor);
9351
	cu.codeComplete(cursorLocation, requestor);
9797
9352
9798
	assertResults(
9353
	options.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES,argumentPrefixPreviousValue);
9799
			"zzvarzz[FIELD_REF]{zzvarzz, LCompletionBasicField1;, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9354
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,localPrefixPreviousValue);
9800
			requestor.getResults());
9355
	JavaCore.setOptions(options);
9356
9357
	assertEquals(
9358
		"element:exception    completion:exception    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
9359
		"element:locException    completion:locException    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX+ R_NON_RESTRICTED),
9360
		requestor.getResults());
9801
}
9361
}
9802
public void testCompletionBasicMethod1() throws JavaModelException {
9362
public void testCompletionArrayAccess1() throws JavaModelException {
9803
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9363
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9804
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethod1.java");
9364
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArrayAccess1.java");
9805
9365
9806
	String str = cu.getSource();
9366
	String str = cu.getSource();
9807
	String completeBehind = "zzfo";
9367
	String completeBehind = "zzz";
9808
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9368
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9809
	cu.codeComplete(cursorLocation, requestor);
9369
	cu.codeComplete(cursorLocation, requestor);
9810
9370
9811
	assertResults(
9371
	assertEquals(
9812
			"zzfoo[METHOD_REF]{zzfoo(), LCompletionBasicMethod1;, ()V, zzfoo, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9372
		"element:zzz1    completion:zzz1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9373
		"element:zzz2    completion:zzz2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE +R_UNQUALIFIED+ R_NON_RESTRICTED),
9374
		requestor.getResults());
9375
}
9376
public void testCompletionVariableName3() throws JavaModelException {
9377
	Hashtable options = JavaCore.getOptions();
9378
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9379
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"p1,p2"); //$NON-NLS-1$
9380
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9381
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"s1,s2"); //$NON-NLS-1$
9382
	
9383
	JavaCore.setOptions(options);
9384
9385
	try {
9386
		CompletionTestsRequestor requestor = new CompletionTestsRequestor();
9387
		ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionVariableName3.java");
9388
	
9389
		String str = cu.getSource();
9390
		String completeBehind = "OneName ";
9391
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9392
		cu.codeComplete(cursorLocation, requestor);
9393
	
9394
		assertEquals(
9395
			"element:name    completion:name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
9396
			"element:names1    completion:names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9397
			"element:names2    completion:names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
9398
			"element:oneName    completion:oneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"\n"+
9399
			"element:oneNames1    completion:oneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9400
			"element:oneNames2    completion:oneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
9401
			"element:p1Name    completion:p1Name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+
9402
			"element:p1Names1    completion:p1Names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9403
			"element:p1Names2    completion:p1Names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
9404
			"element:p1OneName    completion:p1OneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"\n"+
9405
			"element:p1OneNames1    completion:p1OneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9406
			"element:p1OneNames2    completion:p1OneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
9407
			"element:p2Name    completion:p2Name    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+
9408
			"element:p2Names1    completion:p2Names1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9409
			"element:p2Names2    completion:p2Names2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX + R_NON_RESTRICTED)+"\n"+
9410
			"element:p2OneName    completion:p2OneName    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NON_RESTRICTED)+"\n"+
9411
			"element:p2OneNames1    completion:p2OneNames1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"\n"+
9412
			"element:p2OneNames2    completion:p2OneNames2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_PREFIX + R_NAME_SUFFIX+ R_NON_RESTRICTED),
9813
			requestor.getResults());
9413
			requestor.getResults());
9414
	} finally {
9415
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9416
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9417
		JavaCore.setOptions(options);
9418
	}
9814
}
9419
}
9815
public void testCompletionBasicLocalVariable1() throws JavaModelException {
9420
public void testCompletionVariableName4() throws JavaModelException {
9816
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9421
	this.wc = getWorkingCopy(
9817
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicLocalVariable1.java");
9422
            "/Completion/src/CompletionVariableName4.java",
9423
            "class FooBar {\n"+
9424
            "}\n"+
9425
            "public class CompletionVariableName4 {\n"+
9426
            "	void foo(){\n"+
9427
            "		FooBar the\n"+
9428
            "	}\n"+
9429
            "}");
9430
    
9431
    
9432
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9433
    String str = this.wc.getSource();
9434
    String completeBehind = "the";
9435
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9436
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9818
9437
9819
	String str = cu.getSource();
9438
    assertResults(
9820
	String completeBehind = "zzvar";
9439
    		"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9821
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9440
			"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}",
9822
	cu.codeComplete(cursorLocation, requestor);
9441
			requestor.getResults());
9442
}
9443
public void testCompletionVariableName5() throws JavaModelException {
9444
	this.wc = getWorkingCopy(
9445
            "/Completion/src/CompletionVariableName5.java",
9446
            "class FooBar {\n"+
9447
            "}\n"+
9448
            "public class CompletionVariableName5 {\n"+
9449
            "	void foo(){\n"+
9450
            "		FooBar thefo\n"+
9451
            "	}\n"+
9452
            "}");
9453
    
9454
    
9455
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9456
    String str = this.wc.getSource();
9457
    String completeBehind = "thefo";
9458
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9459
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9823
9460
9824
	assertResults(
9461
    assertResults(
9825
			"zzvarzz[LOCAL_VARIABLE_REF]{zzvarzz, null, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9462
    		"thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9463
			"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
9826
			requestor.getResults());
9464
			requestor.getResults());
9827
}
9465
}
9828
public void testCompletionBasicKeyword1() throws JavaModelException {
9466
public void testCompletionVariableName6() throws JavaModelException {
9829
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9467
	this.wc = getWorkingCopy(
9830
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicKeyword1.java");
9468
            "/Completion/src/CompletionVariableName6.java",
9469
            "class FooBar {\n"+
9470
            "}\n"+
9471
            "public class CompletionVariableName6 {\n"+
9472
            "	void foo(){\n"+
9473
            "		FooBar theba\n"+
9474
            "	}\n"+
9475
            "}");
9476
    
9477
    
9478
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9479
    String str = this.wc.getSource();
9480
    String completeBehind = "theba";
9481
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9482
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9831
9483
9832
	String str = cu.getSource();
9484
    assertResults(
9833
	String completeBehind = "whil";
9485
    		"thebaFooBar[VARIABLE_DECLARATION]{thebaFooBar, null, LFooBar;, thebaFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9834
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9486
			"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
9835
	cu.codeComplete(cursorLocation, requestor);
9487
			requestor.getResults());
9488
}
9489
public void testCompletionVariableName7() throws JavaModelException {
9490
	this.wc = getWorkingCopy(
9491
            "/Completion/src/CompletionVariableName7.java",
9492
            "class FooBar {\n"+
9493
            "}\n"+
9494
            "public class CompletionVariableName7 {\n"+
9495
            "	void foo(){\n"+
9496
            "		FooBar fo\n"+
9497
            "	}\n"+
9498
            "}");
9499
    
9500
    
9501
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9502
    String str = this.wc.getSource();
9503
    String completeBehind = "fo";
9504
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9505
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9836
9506
9837
	assertResults(
9507
    assertResults(
9838
			"while[KEYWORD]{while, null, null, while, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
9508
			"foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9509
			"fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
9839
			requestor.getResults());
9510
			requestor.getResults());
9840
}
9511
}
9841
public void testCompletionBasicVariableDeclaration1() throws JavaModelException {
9512
public void testCompletionVariableName8() throws JavaModelException {
9842
	this.workingCopies = new ICompilationUnit[1];
9513
	Hashtable options = JavaCore.getOptions();
9843
	this.workingCopies[0] = getWorkingCopy(
9514
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9844
		"/Completion/src/CompletionBasicVariableDeclaration1.java",
9515
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9845
		"public class CompletionBasicVariableDeclaration1 {\n"+
9516
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9846
		"	public Object obj;\n"+
9517
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9847
		"}\n");
9848
	
9849
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9850
	String str = this.workingCopies[0].getSource();
9851
	String completeBehind = "obj";
9852
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9853
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9854
	
9518
	
9855
	assertResults(
9519
	JavaCore.setOptions(options);
9856
		"object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
9857
		requestor.getResults());
9858
}
9859
public void testCompletionBasicMethodDeclaration1() throws JavaModelException {
9860
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9861
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethodDeclaration1.java");
9862
9863
	String str = cu.getSource();
9864
	String completeBehind = "equals";
9865
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9866
	cu.codeComplete(cursorLocation, requestor);
9867
9520
9868
	assertResults(
9521
	try {
9869
			"equals[POTENTIAL_METHOD_DECLARATION]{equals, LCompletionBasicMethodDeclaration1;, ()V, equals, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9522
		this.wc = getWorkingCopy(
9870
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
9523
	            "/Completion/src/CompletionVariableName8.java",
9871
			requestor.getResults());
9524
	            "class FooBar {\n"+
9525
	            "}\n"+
9526
	            "public class CompletionVariableName8 {\n"+
9527
	            "	void foo(){\n"+
9528
	            "		FooBar the\n"+
9529
	            "	}\n"+
9530
	            "}");
9531
	    
9532
	    
9533
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9534
	    String str = this.wc.getSource();
9535
	    String completeBehind = "the";
9536
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9537
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9538
	
9539
	    assertResults(
9540
				"theBar[VARIABLE_DECLARATION]{theBar, null, LFooBar;, theBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9541
				"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9542
				"theBarsuf[VARIABLE_DECLARATION]{theBarsuf, null, LFooBar;, theBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9543
				"theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}",
9544
				requestor.getResults());
9545
	} finally {
9546
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9547
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9548
		JavaCore.setOptions(options);
9549
	}
9872
}
9550
}
9873
public void testCompletionBasicAnonymousDeclaration1() throws JavaModelException {
9551
public void testCompletionVariableName9() throws JavaModelException {
9874
	CompletionResult result = complete(
9552
	Hashtable options = JavaCore.getOptions();
9875
			"/Completion/src3/test0000/CompletionBasicCompletionContext.java",
9553
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9876
			"public class CompletionBasicAnonymousDeclaration1 {\n"+
9554
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9877
			"	void foo() {\n"+
9555
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9878
			"		new Object(\n"+
9556
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9879
			"	}\n"+
9880
			"}",
9881
			"new Object(");
9882
	
9557
	
9883
	assertResults(
9558
	JavaCore.setOptions(options);
9884
			"expectedTypesSignatures=null\n" +
9559
9885
			"expectedTypesKeys=null",
9560
	try {
9886
			result.context);
9561
		this.wc = getWorkingCopy(
9562
	            "/Completion/src/CompletionVariableName9.java",
9563
	            "class FooBar {\n"+
9564
	            "}\n"+
9565
	            "public class CompletionVariableName9 {\n"+
9566
	            "	void foo(){\n"+
9567
	            "		FooBar thefo\n"+
9568
	            "	}\n"+
9569
	            "}");
9570
	    
9571
	    
9572
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9573
	    String str = this.wc.getSource();
9574
	    String completeBehind = "thefo";
9575
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9576
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9887
	
9577
	
9888
	assertResults(
9578
	    assertResults(
9889
			"Object[ANONYMOUS_CLASS_DECLARATION]{, Ljava.lang.Object;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9579
				"thefoBar[VARIABLE_DECLARATION]{thefoBar, null, LFooBar;, thefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9890
			"Object[METHOD_REF<CONSTRUCTOR>]{, Ljava.lang.Object;, ()V, Object, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
9580
				"thefoBarsuf[VARIABLE_DECLARATION]{thefoBarsuf, null, LFooBar;, thefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9891
			result.proposals);
9581
				"theFooBar[VARIABLE_DECLARATION]{theFooBar, null, LFooBar;, theFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
9582
				"theFooBarsuf[VARIABLE_DECLARATION]{theFooBarsuf, null, LFooBar;, theFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
9583
				requestor.getResults());
9584
	} finally {
9585
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9586
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9587
		JavaCore.setOptions(options);
9588
	}
9892
}
9589
}
9893
public void testCompletionBasicCompletionContext() throws JavaModelException {
9590
public void testCompletionVariableName10() throws JavaModelException {
9894
	CompletionResult result = complete(
9591
	Hashtable options = JavaCore.getOptions();
9895
			"/Completion/src3/test0000/CompletionBasicCompletionContext.java",
9592
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9896
			"package test0000;\n" +
9593
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9897
			"public class CompletionBasicCompletionContext {\n" +
9594
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9898
			"  void bar(String o) {\n" +
9595
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9899
			"    String zzz = null; \n" + 
9900
			"    o = zzz\n" + 
9901
			"  }\n" +
9902
			"}",
9903
			"zzz");
9904
	
9596
	
9905
	assertResults(
9597
	JavaCore.setOptions(options);
9906
			"expectedTypesSignatures={Ljava.lang.String;}\n" +
9598
9907
			"expectedTypesKeys={Ljava/lang/String;}",
9599
	try {
9908
			result.context);
9600
		this.wc = getWorkingCopy(
9601
	            "/Completion/src/CompletionVariableName10.java",
9602
	            "class FooBar {\n"+
9603
	            "}\n"+
9604
	            "public class CompletionVariableName10 {\n"+
9605
	            "	void foo(){\n"+
9606
	            "		FooBar fo\n"+
9607
	            "	}\n"+
9608
	            "}");
9609
	    
9610
	    
9611
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9612
	    String str = this.wc.getSource();
9613
	    String completeBehind = "fo";
9614
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9615
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9909
	
9616
	
9910
	assertResults(
9617
	    assertResults(
9911
			"zzz[LOCAL_VARIABLE_REF]{zzz, null, Ljava.lang.String;, zzz, null, " + (R_DEFAULT + R_INTERESTING + R_CASE +  + R_EXACT_NAME + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9618
				"foBar[VARIABLE_DECLARATION]{foBar, null, LFooBar;, foBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
9912
			result.proposals);
9619
				"foBarsuf[VARIABLE_DECLARATION]{foBarsuf, null, LFooBar;, foBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9620
				"fooBar[VARIABLE_DECLARATION]{fooBar, null, LFooBar;, fooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
9621
				"fooBarsuf[VARIABLE_DECLARATION]{fooBarsuf, null, LFooBar;, fooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_LESS_NEW_CHARACTERS + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
9622
				requestor.getResults());
9623
	} finally {
9624
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9625
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9626
		JavaCore.setOptions(options);
9627
	}
9913
}
9628
}
9914
public void testCompletionBasicPotentialMethodDeclaration1() throws JavaModelException {
9629
public void testCompletionVariableName11() throws JavaModelException {
9915
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
9630
	Hashtable options = JavaCore.getOptions();
9916
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPotentialMethodDeclaration1.java");
9631
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9917
9632
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9918
	String str = cu.getSource();
9633
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9919
	String completeBehind = "zzpot";
9634
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9920
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9635
	
9921
	cu.codeComplete(cursorLocation, requestor);
9636
	JavaCore.setOptions(options);
9922
9637
9923
	assertResults(
9638
	try {
9924
			"zzpot[POTENTIAL_METHOD_DECLARATION]{zzpot, LCompletionBasicPotentialMethodDeclaration1;, ()V, zzpot, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
9639
		this.wc = getWorkingCopy(
9925
			requestor.getResults());
9640
	            "/Completion/src/CompletionVariableName11.java",
9926
}
9641
	            "class FooBar {\n"+
9927
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82740
9642
	            "}\n"+
9928
public void testCompletionInsideGenericClass() throws JavaModelException {
9643
	            "public class CompletionVariableName11 {\n"+
9929
	this.wc = getWorkingCopy(
9644
	            "	void foo(){\n"+
9930
			"/Completion/src/test/CompletionInsideGenericClass.java",
9645
	            "		FooBar pr\n"+
9931
			"package test;\n" +
9646
	            "	}\n"+
9932
			"public class CompletionInsideGenericClass <CompletionInsideGenericClassParameter> {\n" +
9647
	            "}");
9933
			"  CompletionInsideGenericClas\n" +
9648
	    
9934
			"}");
9649
	    
9650
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9651
	    String str = this.wc.getSource();
9652
	    String completeBehind = "pr";
9653
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9654
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9935
	
9655
	
9656
	    assertResults(
9657
				"preBar[VARIABLE_DECLARATION]{preBar, null, LFooBar;, preBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9658
				"preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9659
				"preBarsuf[VARIABLE_DECLARATION]{preBarsuf, null, LFooBar;, preBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX+ R_NON_RESTRICTED)+"}\n"+
9660
				"preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
9661
				requestor.getResults());
9662
	} finally {
9663
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9664
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9665
		JavaCore.setOptions(options);
9666
	}
9667
}
9668
public void testCompletionVariableName12() throws JavaModelException {
9669
	Hashtable options = JavaCore.getOptions();
9670
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9671
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9672
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9673
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9936
	
9674
	
9937
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9675
	JavaCore.setOptions(options);
9938
	String str = this.wc.getSource();
9939
	String completeBehind = "CompletionInsideGenericClas";
9940
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9941
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9942
9676
9943
	assertResults(
9677
	try {
9944
			"CompletionInsideGenericClas[POTENTIAL_METHOD_DECLARATION]{CompletionInsideGenericClas, Ltest.CompletionInsideGenericClass;, ()V, CompletionInsideGenericClas, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
9678
		this.wc = getWorkingCopy(
9945
			"CompletionInsideGenericClass[TYPE_REF]{CompletionInsideGenericClass, test, Ltest.CompletionInsideGenericClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9679
	            "/Completion/src/CompletionVariableName12.java",
9946
			requestor.getResults());
9680
	            "class FooBar {\n"+
9681
	            "}\n"+
9682
	            "public class CompletionVariableName12 {\n"+
9683
	            "	void foo(){\n"+
9684
	            "		FooBar prethe\n"+
9685
	            "	}\n"+
9686
	            "}");
9687
	    
9688
	    
9689
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9690
	    String str = this.wc.getSource();
9691
	    String completeBehind = "prethe";
9692
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9693
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9694
	
9695
	    assertResults(
9696
				"preTheBar[VARIABLE_DECLARATION]{preTheBar, null, LFooBar;, preTheBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9697
				"preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9698
				"preTheBarsuf[VARIABLE_DECLARATION]{preTheBarsuf, null, LFooBar;, preTheBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9699
				"preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}",
9700
				requestor.getResults());
9701
	} finally {
9702
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9703
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9704
		JavaCore.setOptions(options);
9705
	}
9947
}
9706
}
9948
9707
public void testCompletionVariableName13() throws JavaModelException {
9949
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9708
	Hashtable options = JavaCore.getOptions();
9950
public void testCompletionInsideExtends1() throws JavaModelException {
9709
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9951
	this.wc = getWorkingCopy(
9710
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9952
			"/Completion/src/test/CompletionInsideExtends1.java",
9711
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9953
			"package test;\n" +
9712
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9954
			"public class CompletionInsideExtends1 extends  {\n" +
9955
			"  public class CompletionInsideExtends1Inner {}\n" +
9956
			"}\n" +
9957
			"class CompletionInsideExtends1TopLevel {\n" +
9958
			"}");
9959
	
9713
	
9714
	JavaCore.setOptions(options);
9715
9716
	try {
9717
		this.wc = getWorkingCopy(
9718
	            "/Completion/src/CompletionVariableName13.java",
9719
	            "class FooBar {\n"+
9720
	            "}\n"+
9721
	            "public class CompletionVariableName13 {\n"+
9722
	            "	void foo(){\n"+
9723
	            "		FooBar prefo\n"+
9724
	            "	}\n"+
9725
	            "}");
9726
	    
9727
	    
9728
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9729
	    String str = this.wc.getSource();
9730
	    String completeBehind = "prefo";
9731
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9732
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9960
	
9733
	
9961
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9734
	    assertResults(
9962
	String str = this.wc.getSource();
9735
				"preFoBar[VARIABLE_DECLARATION]{preFoBar, null, LFooBar;, preFoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
9963
	String completeBehind = "extends ";
9736
				"preFoBarsuf[VARIABLE_DECLARATION]{preFoBarsuf, null, LFooBar;, preFoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
9964
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9737
				"preFooBar[VARIABLE_DECLARATION]{preFooBar, null, LFooBar;, preFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
9965
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9738
				"preFooBarsuf[VARIABLE_DECLARATION]{preFooBarsuf, null, LFooBar;, preFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
9966
9967
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9968
		assertResults(
9969
				"",
9970
				requestor.getResults());
9971
	} else {
9972
		assertResults(
9973
				"CompletionInsideExtends1TopLevel[TYPE_REF]{CompletionInsideExtends1TopLevel, test, Ltest.CompletionInsideExtends1TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9974
				requestor.getResults());
9739
				requestor.getResults());
9740
	} finally {
9741
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9742
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9743
		JavaCore.setOptions(options);
9975
	}
9744
	}
9976
	
9977
}
9745
}
9978
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9746
public void testCompletionVariableName14() throws JavaModelException {
9979
public void testCompletionInsideExtends2() throws JavaModelException {
9747
	Hashtable options = JavaCore.getOptions();
9980
	this.wc = getWorkingCopy(
9748
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
9981
			"/Completion/src/test/CompletionInsideExtends2.java",
9749
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
9982
			"package test;\n" +
9750
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
9983
			"public class CompletionInsideExtends2 extends CompletionInsideExtends {\n" +
9751
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
9984
			"  public class CompletionInsideExtends2Inner {}\n" +
9985
			"}\n" +
9986
			"class CompletionInsideExtends2TopLevel {\n" +
9987
			"}");
9988
	
9989
	
9752
	
9990
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9753
	JavaCore.setOptions(options);
9991
	String str = this.wc.getSource();
9992
	String completeBehind = "extends CompletionInsideExtends";
9993
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9994
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9995
9754
9996
	assertResults(
9755
	try {
9997
			"CompletionInsideExtends2TopLevel[TYPE_REF]{CompletionInsideExtends2TopLevel, test, Ltest.CompletionInsideExtends2TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9756
		this.wc = getWorkingCopy(
9998
			requestor.getResults());
9757
	            "/Completion/src/CompletionVariableName14.java",
9999
}
9758
	            "class FooBar {\n"+
10000
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9759
	            "}\n"+
10001
public void testCompletionInsideExtends3() throws JavaModelException {
9760
	            "public class CompletionVariableName14 {\n"+
10002
	this.wc = getWorkingCopy(
9761
	            "	void foo(){\n"+
10003
			"/Completion/src/test/CompletionInsideExtends3.java",
9762
	            "		FooBar prethefo\n"+
10004
			"package test;\n" +
9763
	            "	}\n"+
10005
			"public class CompletionInsideExtends3 {\n" +
9764
	            "}");
10006
			"  public class CompletionInsideExtends3Inner extends {\n" +
9765
	    
10007
			"    public class CompletionInsideExtends3InnerInner {\n" +
9766
	    
10008
			"    }\n" +
9767
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10009
			"  }\n" +
9768
	    String str = this.wc.getSource();
10010
			"}\n" +
9769
	    String completeBehind = "prethefo";
10011
			"class CompletionInsideExtends3TopLevel {\n" +
9770
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10012
			"}");
9771
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10013
	
10014
	
9772
	
10015
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9773
	    assertResults(
10016
	String str = this.wc.getSource();
9774
				"preThefoBar[VARIABLE_DECLARATION]{preThefoBar, null, LFooBar;, preThefoBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NON_RESTRICTED)+"}\n"+
10017
	String completeBehind = "extends ";
9775
				"preThefoBarsuf[VARIABLE_DECLARATION]{preThefoBarsuf, null, LFooBar;, preThefoBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NON_RESTRICTED)+"}\n"+
10018
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9776
				"preTheFooBar[VARIABLE_DECLARATION]{preTheFooBar, null, LFooBar;, preTheFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}\n"+
10019
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9777
				"preTheFooBarsuf[VARIABLE_DECLARATION]{preTheFooBarsuf, null, LFooBar;, preTheFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_PREFIX + R_NAME_FIRST_SUFFIX + R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED)+"}",
10020
10021
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10022
		assertResults(
10023
				"",
10024
				requestor.getResults());
10025
	} else {
10026
		assertResults(
10027
				"CompletionInsideExtends3[TYPE_REF]{CompletionInsideExtends3, test, Ltest.CompletionInsideExtends3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10028
				"CompletionInsideExtends3TopLevel[TYPE_REF]{CompletionInsideExtends3TopLevel, test, Ltest.CompletionInsideExtends3TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10029
				requestor.getResults());
9778
				requestor.getResults());
9779
	} finally {
9780
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9781
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9782
		JavaCore.setOptions(options);
10030
	}
9783
	}
10031
}
9784
}
10032
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9785
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=128045
10033
public void testCompletionInsideExtends4() throws JavaModelException {
9786
public void testCompletionVariableName15() throws JavaModelException {
10034
	this.wc = getWorkingCopy(
9787
	Hashtable options = JavaCore.getOptions();
10035
			"/Completion/src/test/CompletionInsideExtends4.java",
9788
	Object argumentPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_PREFIXES);
10036
			"package test;\n" +
9789
	options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,"pre"); //$NON-NLS-1$
10037
			"public class CompletionInsideExtends4 {\n" +
9790
	Object localPrefixPreviousValue = options.get(JavaCore.CODEASSIST_LOCAL_SUFFIXES);
10038
			"  public class CompletionInsideExtends4Inner extends CompletionInsideExtends{\n" +
9791
	options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,"suf"); //$NON-NLS-1$
10039
			"    public class CompletionInsideExtends4InnerInner {\n" +
10040
			"    }\n" +
10041
			"  }\n" +
10042
			"\n}" +
10043
			"class CompletionInsideExtends4TopLevel {\n" +
10044
			"}");
10045
	
10046
	
9792
	
10047
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9793
	JavaCore.setOptions(options);
10048
	String str = this.wc.getSource();
10049
	String completeBehind = "extends CompletionInsideExtends";
10050
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10051
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10052
9794
10053
	assertResults(
9795
	try {
10054
			"CompletionInsideExtends4[TYPE_REF]{CompletionInsideExtends4, test, Ltest.CompletionInsideExtends4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
9796
		this.wc = getWorkingCopy(
10055
			"CompletionInsideExtends4TopLevel[TYPE_REF]{CompletionInsideExtends4TopLevel, test, Ltest.CompletionInsideExtends4TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9797
	            "/Completion/src/CompletionVariableName15.java",
10056
			requestor.getResults());
9798
	            "class FooBar {\n"+
10057
}
9799
	            "}\n"+
10058
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9800
	            "public class CompletionVariableName15 {\n"+
10059
public void testCompletionInsideExtends5() throws JavaModelException {
9801
	            "	void foo(){\n"+
10060
	this.wc = getWorkingCopy(
9802
	            "		FooBar pro\n"+
10061
			"/Completion/src/test/CompletionInsideExtends5.java",
9803
	            "	}\n"+
10062
			"package test;\n" +
9804
	            "}");
10063
			"public class CompletionInsideExtends5 {\n" +
9805
	    
10064
			"  void foo() {\n" +
9806
	    
10065
			"    public class CompletionInsideExtends5Inner extends {\n" +
9807
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10066
			"      public class CompletionInsideExtends5InnerInner {\n" +
9808
	    String str = this.wc.getSource();
10067
			"      }\n" +
9809
	    String completeBehind = "pro";
10068
			"    }\n" +
9810
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10069
			"  }\n" +
9811
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10070
			"}\n" +
10071
			"class CompletionInsideExtends5TopLevel {\n" +
10072
			"}");
10073
	
10074
	
9812
	
10075
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9813
	    assertResults(
10076
	String str = this.wc.getSource();
9814
				"proBar[VARIABLE_DECLARATION]{proBar, null, LFooBar;, proBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
10077
	String completeBehind = "extends ";
9815
				"proFooBar[VARIABLE_DECLARATION]{proFooBar, null, LFooBar;, proFooBar, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n"+
10078
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9816
				"proBarsuf[VARIABLE_DECLARATION]{proBarsuf, null, LFooBar;, proBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}\n"+
10079
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9817
				"proFooBarsuf[VARIABLE_DECLARATION]{proFooBarsuf, null, LFooBar;, proFooBarsuf, null, "+(R_DEFAULT + R_INTERESTING + R_NAME_FIRST_SUFFIX + R_CASE + R_NON_RESTRICTED)+"}",
10080
10081
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10082
		assertResults(
10083
				"",
10084
				requestor.getResults());
10085
	} else {
10086
		assertResults(
10087
				"CompletionInsideExtends5[TYPE_REF]{CompletionInsideExtends5, test, Ltest.CompletionInsideExtends5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10088
				"CompletionInsideExtends5TopLevel[TYPE_REF]{CompletionInsideExtends5TopLevel, test, Ltest.CompletionInsideExtends5TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10089
				requestor.getResults());
9818
				requestor.getResults());
9819
	} finally {
9820
		options.put(JavaCore.CODEASSIST_LOCAL_PREFIXES,argumentPrefixPreviousValue);
9821
		options.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES,localPrefixPreviousValue);
9822
		JavaCore.setOptions(options);
10090
	}
9823
	}
10091
}
9824
}
10092
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9825
public void testCompletionNonEmptyToken1() throws JavaModelException {
10093
public void testCompletionInsideExtends6() throws JavaModelException {
9826
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10094
	this.wc = getWorkingCopy(
9827
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonEmptyToken1.java");
10095
			"/Completion/src/test/CompletionInsideExtends6.java",
9828
10096
			"package test;\n" +
9829
	String str = cu.getSource();
10097
			"public class CompletionInsideExtends6 {\n" +
9830
	String completeBehind = "zz";
10098
			"  void foo() {\n" +
10099
			"    public class CompletionInsideExtends6Inner extends CompletionInsideExtends {\n" +
10100
			"      public class CompletionInsideExtends6InnerInner {\n" +
10101
			"      }\n" +
10102
			"    }\n" +
10103
			"  }\n" +
10104
			"}\n" +
10105
			"class CompletionInsideExtends6TopLevel {\n" +
10106
			"}");
10107
	
10108
	
10109
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10110
	String str = this.wc.getSource();
10111
	String completeBehind = "extends CompletionInsideExtends";
10112
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9831
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10113
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9832
	int start = cursorLocation - 2;
9833
	int end = start + 4;
9834
	cu.codeComplete(cursorLocation, requestor);
10114
9835
10115
	assertResults(
9836
	assertEquals(
10116
			"CompletionInsideExtends6[TYPE_REF]{CompletionInsideExtends6, test, Ltest.CompletionInsideExtends6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
9837
		"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
10117
			"CompletionInsideExtends6TopLevel[TYPE_REF]{CompletionInsideExtends6TopLevel, test, Ltest.CompletionInsideExtends6TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9838
		requestor.getResultsWithPosition());
10118
			requestor.getResults());
10119
}
9839
}
10120
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9840
public void testCompletionEmptyToken1() throws JavaModelException {
10121
public void testCompletionInsideExtends7() throws JavaModelException {
9841
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10122
	this.wc = getWorkingCopy(
9842
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionEmptyToken1.java");
10123
			"/Completion/src/test/CompletionInsideExtends7.java",
9843
10124
			"package test;\n" +
9844
	String str = cu.getSource();
10125
			"public interface CompletionInsideExtends7 extends  {\n" +
9845
	String completeBehind = "zz";
10126
			"  public interface CompletionInsideExtends7Inner {}\n" +
9846
	// completion is just at start of 'zz'
10127
			"}\n" +
9847
	int cursorLocation = str.lastIndexOf(completeBehind);
10128
			"interface CompletionInsideExtends7TopLevel {\n" +
9848
	int start = cursorLocation;
10129
			"}");
9849
	int end = start + 4;
10130
	
9850
	cu.codeComplete(cursorLocation, requestor);
10131
	
10132
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10133
	String str = this.wc.getSource();
10134
	String completeBehind = "extends ";
10135
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10136
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10137
9851
10138
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9852
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10139
		assertResults(
9853
		assertEquals(
10140
				"",
9854
			"element:clone    completion:clone()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
10141
				requestor.getResults());
9855
			"element:equals    completion:equals()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9856
			"element:finalize    completion:finalize()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9857
			"element:foo    completion:foo()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9858
			"element:getClass    completion:getClass()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9859
			"element:hashCode    completion:hashCode()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9860
			"element:notify    completion:notify()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9861
			"element:notifyAll    completion:notifyAll()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9862
			"element:toString    completion:toString()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9863
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9864
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9865
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9866
			"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9867
			requestor.getResultsWithPosition());
10142
	} else {
9868
	} else {
10143
		assertResults(
9869
		assertEquals(
10144
				"CompletionInsideExtends7TopLevel[TYPE_REF]{CompletionInsideExtends7TopLevel, test, Ltest.CompletionInsideExtends7TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9870
			"element:CompletionEmptyToken1    completion:CompletionEmptyToken1    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
10145
				requestor.getResults());
9871
			"element:clone    completion:clone()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9872
			"element:equals    completion:equals()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9873
			"element:finalize    completion:finalize()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9874
			"element:foo    completion:foo()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9875
			"element:getClass    completion:getClass()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9876
			"element:hashCode    completion:hashCode()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9877
			"element:notify    completion:notify()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9878
			"element:notifyAll    completion:notifyAll()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9879
			"element:toString    completion:toString()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9880
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9881
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9882
			"element:wait    completion:wait()    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
9883
			"element:zzyy    completion:zzyy    position:["+start+","+end+"]    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
9884
			requestor.getResultsWithPosition());
10146
	}
9885
	}
10147
}
9886
}
10148
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9887
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=100808
10149
public void testCompletionInsideExtends8() throws JavaModelException {
9888
public void testCompletionEmptyToken2() throws JavaModelException {
10150
	this.wc = getWorkingCopy(
9889
    this.wc = getWorkingCopy(
10151
			"/Completion/src/test/CompletionInsideExtends8.java",
9890
            "/Completion/src/testCompletionEmptyToken2/Test.java",
10152
			"package test;\n" +
9891
            "package testCompletionEmptyToken2.");
10153
			"public interface CompletionInsideExtends8 extends CompletionInsideExtends {\n" +
9892
    
10154
			"  public interface CompletionInsideExtends8Inner {}\n" +
9893
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true);
10155
			"}\n" +
9894
    
10156
			"interface CompletionInsideExtends8TopLevel {\n" +
9895
    String str = this.wc.getSource();
10157
			"}");
9896
    String completeBehind = "testCompletionEmptyToken2.";
10158
	
9897
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10159
	
9898
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10160
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10161
	String str = this.wc.getSource();
10162
	String completeBehind = "extends CompletionInsideExtends";
10163
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10164
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10165
9899
9900
    int start = str.lastIndexOf(completeBehind);
9901
    int end = start + completeBehind.length();
9902
    
9903
    assertResults(
9904
            "expectedTypesSignatures=null\n"+
9905
            "expectedTypesKeys=null",
9906
            requestor.getContext());
9907
    
10166
	assertResults(
9908
	assertResults(
10167
			"CompletionInsideExtends8TopLevel[TYPE_REF]{CompletionInsideExtends8TopLevel, test, Ltest.CompletionInsideExtends8TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
9909
            "testCompletionEmptyToken2[PACKAGE_REF]{testCompletionEmptyToken2, testCompletionEmptyToken2, null, null, null, ["+start+", "+end+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
10168
			requestor.getResults());
9910
            requestor.getResults());
10169
}
9911
}
10170
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9912
public void testCompletionFindSecondaryType1() throws JavaModelException {
10171
public void testCompletionInsideExtends9() throws JavaModelException {
9913
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10172
	this.wc = getWorkingCopy(
9914
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionFindSecondaryType1.java");
10173
			"/Completion/src/test/CompletionInsideExtends9.java",
10174
			"package test;\n" +
10175
			"public interface CompletionInsideExtends9 {\n" +
10176
			"  public interface CompletionInsideExtends9Inner extends {\n" +
10177
			"    public interface CompletionInsideExtends9InnerInner {\n" +
10178
			"    }\n" +
10179
			"  }\n" +
10180
			"}\n" +
10181
			"interface CompletionInsideExtends9TopLevel {\n" +
10182
			"}");
10183
	
10184
	
10185
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10186
	String str = this.wc.getSource();
10187
	String completeBehind = "extends ";
10188
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10189
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10190
9915
10191
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9916
	String str = cu.getSource();
10192
		assertResults(
9917
	String completeBehind = "/**/Secondary";
10193
				"",
10194
				requestor.getResults());
10195
	} else {
10196
		assertResults(
10197
				"CompletionInsideExtends9[TYPE_REF]{CompletionInsideExtends9, test, Ltest.CompletionInsideExtends9;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10198
				"CompletionInsideExtends9TopLevel[TYPE_REF]{CompletionInsideExtends9TopLevel, test, Ltest.CompletionInsideExtends9TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10199
				requestor.getResults());
10200
	}
10201
}
10202
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
10203
public void testCompletionInsideExtends10() throws JavaModelException {
10204
	this.wc = getWorkingCopy(
10205
			"/Completion/src/test/CompletionInsideExtends10.java",
10206
			"package test;\n" +
10207
			"public interface CompletionInsideExtends10 {\n" +
10208
			"  public interface CompletionInsideExtends10Inner extends CompletionInsideExtends{\n" +
10209
			"    public interface CompletionInsideExtends10InnerInner {\n" +
10210
			"    }\n" +
10211
			"  }\n" +
10212
			"}\n" +
10213
			"interface CompletionInsideExtends10TopLevel {\n" +
10214
			"}");
10215
	
10216
	
10217
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10218
	String str = this.wc.getSource();
10219
	String completeBehind = "extends CompletionInsideExtends";
10220
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9918
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10221
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9919
	cu.codeComplete(cursorLocation, requestor);
10222
9920
10223
	if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
9921
	assertEquals(
10224
		assertResults(
9922
		"element:SecondaryType1    completion:SecondaryType1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
10225
				"CompletionInsideExtends10.CompletionInsideExtends10Inner.CompletionInsideExtends10InnerInner[TYPE_REF]{test.CompletionInsideExtends10.CompletionInsideExtends10Inner.CompletionInsideExtends10InnerInner, test, Ltest.CompletionInsideExtends10$CompletionInsideExtends10Inner$CompletionInsideExtends10InnerInner;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_NON_RESTRICTED) + "}\n" +
9923
		"element:SecondaryType2    completion:SecondaryType2    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
10226
				"CompletionInsideExtends10[TYPE_REF]{CompletionInsideExtends10, test, Ltest.CompletionInsideExtends10;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
9924
		requestor.getResults());
10227
				"CompletionInsideExtends10TopLevel[TYPE_REF]{CompletionInsideExtends10TopLevel, test, Ltest.CompletionInsideExtends10TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10228
				requestor.getResults());
10229
	} else {
10230
		assertResults(
10231
				"CompletionInsideExtends10[TYPE_REF]{CompletionInsideExtends10, test, Ltest.CompletionInsideExtends10;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10232
				"CompletionInsideExtends10TopLevel[TYPE_REF]{CompletionInsideExtends10TopLevel, test, Ltest.CompletionInsideExtends10TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10233
				requestor.getResults());
10234
	}
10235
}
9925
}
10236
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9926
public void testCompletionLocalType1() throws JavaModelException {
10237
public void testCompletionInsideExtends11() throws JavaModelException {
9927
	this.workingCopies = new ICompilationUnit[1];
10238
	this.wc = getWorkingCopy(
9928
	this.workingCopies[0] = getWorkingCopy(
10239
			"/Completion/src/test/CompletionInsideExtends11.java",
9929
		"/Completion/src/CompletionLocalType1.java",
10240
			"package test;\n" +
9930
		"public class CompletionLocalType1 {\n" +
10241
			"public class CompletionInsideExtends11 implements {\n" +
9931
		"	void foo() {\n" +
10242
			"  public class CompletionInsideExtends11Inner {\n" +
9932
		"		class ZZZZ {\n" +
10243
			"  }\n" +
9933
		"			ZZZ\n" +
10244
			"}\n" +
9934
		"		}\n" +
10245
			"class CompletionInsideExtends11TopLevel {\n" +
9935
		"	}\n" +
10246
			"}");
9936
		"}");
10247
	
10248
	
9937
	
10249
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9938
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10250
	String str = this.wc.getSource();
9939
	String str = this.workingCopies[0].getSource();
10251
	String completeBehind = "implements ";
9940
	String completeBehind = "ZZZ";
10252
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9941
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10253
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9942
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10254
9943
10255
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
9944
	assertResults(
10256
		assertResults(
9945
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, LZZZZ;, ()V, ZZZ, null, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED)+"}\n"+
10257
				"",
9946
			"ZZZZ[TYPE_REF]{ZZZZ, , LZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}",
10258
				requestor.getResults());
9947
			requestor.getResults());
10259
	} else if (CompletionEngine.PROPOSE_MEMBER_TYPES) {
10260
		assertResults(
10261
				"",
10262
				requestor.getResults());
10263
	} else {
10264
		assertResults(
10265
				"CompletionInsideExtends11TopLevel[TYPE_REF]{CompletionInsideExtends11TopLevel, test, Ltest.CompletionInsideExtends11TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10266
				requestor.getResults());
10267
	}
10268
}
9948
}
10269
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
9949
public void testCompletionType1() throws JavaModelException {
10270
public void testCompletionInsideExtends12() throws JavaModelException {
9950
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10271
	this.wc = getWorkingCopy(
9951
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionType1.java");
10272
			"/Completion/src/test/CompletionInsideExtends12.java",
9952
10273
			"package test;\n" +
9953
	String str = cu.getSource();
10274
			"public class CompletionInsideExtends12 implements CompletionInsideExtends {\n" +
9954
	String completeBehind = "CT1";
10275
			"  public class CompletionInsideExtends12Inner {\n" +
10276
			"  }\n" +
10277
			"}\n" +
10278
			"class CompletionInsideExtends12TopLevel {\n" +
10279
			"}");
10280
	
10281
	
10282
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10283
	String str = this.wc.getSource();
10284
	String completeBehind = "implements CompletionInsideExtends";
10285
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9955
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10286
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9956
	cu.codeComplete(cursorLocation, requestor);
10287
9957
10288
	if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
9958
	assertEquals(
10289
		assertResults(
9959
		"element:CT1    completion:CT1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"\n"+
10290
				"",
9960
		"element:CT1    completion:q2.CT1    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_NON_RESTRICTED),
10291
				requestor.getResults());
9961
		requestor.getResults());
10292
	} else {
10293
		assertResults(
10294
				"CompletionInsideExtends12TopLevel[TYPE_REF]{CompletionInsideExtends12TopLevel, test, Ltest.CompletionInsideExtends12TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10295
				requestor.getResults());
10296
	}
10297
}
9962
}
10298
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690
9963
public void testCompletionQualifiedAllocationType1() throws JavaModelException {
10299
public void testCompletionArrayLength() throws JavaModelException {
9964
	this.wc = getWorkingCopy(
10300
    this.wc = getWorkingCopy(
9965
            "/Completion/src/CompletionQualifiedAllocationType1.java",
10301
            "/Completion/src/test/CompletionArrayLength.java",
9966
            "public class CompletionQualifiedAllocationType1 {\n"+
10302
            "package test;\n" +
9967
            "	public class YYY {\n"+
10303
            "public class CompletionArrayLength {\n" +
9968
            "	}\n"+
10304
            "  public void foo() {\n" +
9969
            "	void foo(){\n"+
10305
            "    long[] var;\n" +
9970
            "		this.new YYY\n"+
10306
            "    var.leng\n" +
9971
            "	}\n"+
10307
            "  }" +
10308
            "}");
9972
            "}");
10309
    
9973
    
10310
    
9974
    
10311
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9975
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10312
    String str = this.wc.getSource();
9976
    String str = this.wc.getSource();
10313
    String completeBehind = "leng";
9977
    String completeBehind = "YYY";
10314
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9978
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10315
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
9979
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10316
9980
10317
    assertResults(
9981
    assertResults(
10318
            "length[FIELD_REF]{length, [J, I, length, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
9982
		"CompletionQualifiedAllocationType1.YYY[TYPE_REF]{YYY, , LCompletionQualifiedAllocationType1$YYY;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME+ R_UNQUALIFIED + R_NON_RESTRICTED)+"}",
10319
            requestor.getResults());
9983
		requestor.getResults());
10320
}
9984
}
10321
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690
9985
public void testCompletionClassLiteralAfterAnonymousType1() throws JavaModelException {
10322
public void testCompletionArrayClone() throws JavaModelException {
9986
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10323
    this.wc = getWorkingCopy(
9987
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionClassLiteralAfterAnonymousType1.java");
10324
            "/Completion/src/test/CompletionArrayClone.java",
9988
10325
            "package test;\n" +
9989
	String str = cu.getSource();
10326
            "public class CompletionArrayClone {\n" +
9990
	String completeBehind = "double.";
10327
            "  public void foo() {\n" +
9991
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10328
            "    long[] var;\n" +
9992
	cu.codeComplete(cursorLocation, requestor);
10329
            "    var.clon\n" +
9993
10330
            "  }\n" +
9994
	assertEquals(
9995
		"element:class    completion:class    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
9996
		requestor.getResults());
9997
}
9998
public void testCompletionArraysCloneMethod() throws JavaModelException {
9999
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10000
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionArraysCloneMethod.java");
10001
10002
	String str = cu.getSource();
10003
	String completeBehind = ".cl";
10004
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10005
	cu.codeComplete(cursorLocation, requestor);
10006
10007
	assertEquals(
10008
		"element:clone    completion:clone()    relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
10009
		requestor.getResults());
10010
}
10011
public void testCompletionAbstractMethod1() throws JavaModelException {
10012
	this.wc = getWorkingCopy(
10013
            "/Completion/src/CompletionAbstractMethod1.java",
10014
            "public class CompletionAbstractMethod1 {\n" +
10015
            "	abstract class A {\n" +
10016
            "		abstract void foo();\n" +
10017
            "	}\n" +
10018
            "	class B extends A {\n" +
10019
            "		void foo{} {}\n" +
10020
            "		void bar() {\n" +
10021
            "			super.fo\n" +
10022
            "		}\n" +
10023
            "	}\n" +
10331
            "}");
10024
            "}");
10332
    
10025
    
10333
    
10026
    
10334
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10027
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10335
    String str = this.wc.getSource();
10028
    String str = this.wc.getSource();
10336
    String completeBehind = "clon";
10029
    String completeBehind = "fo";
10337
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10030
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10338
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10031
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10339
10032
10340
    assertResults(
10033
    assertResults(
10341
            "clone[METHOD_REF]{clone(), [J, ()Ljava.lang.Object;, clone, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
10034
            "",
10342
            requestor.getResults());
10035
            requestor.getResults());
10343
}
10036
}
10344
public void testCompletionAllMemberTypes() throws JavaModelException {
10037
public void testCompletionAbstractMethod2() throws JavaModelException {
10345
    this.wc = getWorkingCopy(
10038
	this.wc = getWorkingCopy(
10346
            "/Completion/src/test/CompletionAllMemberTypes.java",
10039
            "/Completion/src/CompletionAbstractMethod2.java",
10347
            "package test;\n" +
10040
            "public class CompletionAbstractMethod2 {\n" +
10348
            "public class CompletionAllMemberTypes {\n" +
10041
            "	abstract class A {\n" +
10349
            "  class Member1 {\n" +
10042
            "		abstract void foo();\n" +
10350
            "    class Member2 {\n" +
10043
            "	}\n" +
10351
            "      class Member3 {\n" +
10044
            "	class B extends A {\n" +
10352
            "      }\n" +
10045
            "		void foo{} {}\n" +
10353
            "    }\n" +
10046
            "		void bar() {\n" +
10354
            "    void foo(){\n" +
10047
            "			this.fo\n" +
10355
            "      Member\n" +
10048
            "		}\n" +
10356
            "    }\n" +
10049
            "	}\n" +
10357
            "  \n}" +
10358
            "}");
10050
            "}");
10359
    
10051
    
10360
    
10052
    
10361
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10053
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10362
    String str = this.wc.getSource();
10054
    String str = this.wc.getSource();
10363
    String completeBehind = "Member";
10055
    String completeBehind = "fo";
10364
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10056
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10365
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10057
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10366
10058
10367
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10059
    assertResults(
10368
    	assertResults(
10060
           "foo[METHOD_REF]{foo(), LCompletionAbstractMethod2$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED) + "}",
10369
	            "CompletionAllMemberTypes.Member1.Member2.Member3[TYPE_REF]{test.CompletionAllMemberTypes.Member1.Member2.Member3, test, Ltest.CompletionAllMemberTypes$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10061
           requestor.getResults());
10370
				"CompletionAllMemberTypes.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10371
				"CompletionAllMemberTypes.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10372
	            requestor.getResults());
10373
    } else {
10374
    	assertResults(
10375
	            "CompletionAllMemberTypes.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10376
				"CompletionAllMemberTypes.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10377
	            requestor.getResults());
10378
    }
10379
}
10062
}
10380
public void testCompletionAllMemberTypes2() throws JavaModelException {
10063
public void testCompletionAbstractMethod3() throws JavaModelException {
10381
    this.wc = getWorkingCopy(
10064
	this.wc = getWorkingCopy(
10382
            "/Completion/src/test/CompletionAllMemberTypes2.java",
10065
            "/Completion/src/CompletionAbstractMethod3.java",
10383
            "package test;\n" +
10066
            "public class CompletionAbstractMethod3 {\n" +
10384
            "public class CompletionAllMemberTypes2 {\n" +
10067
            "	abstract class A {\n" +
10385
            "  class Member1 {\n" +
10068
            "		abstract void foo();\n" +
10386
            "    class Member5 {\n" +
10069
            "	}\n" +
10387
            "      class Member6 {\n" +
10070
            "	class B extends A {\n" +
10388
            "      }\n" +
10071
            "		void bar() {\n" +
10389
            "    }\n" +
10072
            "			this.fo\n" +
10390
            "    class Member2 {\n" +
10073
            "		}\n" +
10391
            "      class Member3 {\n" +
10074
            "	}\n" +
10392
            "        class Member4 {\n" +
10393
            "        }\n" +
10394
            "      }\n" +
10395
            "      void foo(){\n" +
10396
            "        Member\n" +
10397
            "      }\n" +
10398
            "    }\n" +
10399
            "  \n}" +
10400
            "}");
10075
            "}");
10401
    
10076
    
10402
    
10077
    
10403
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10078
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10404
    String str = this.wc.getSource();
10079
    String str = this.wc.getSource();
10405
    String completeBehind = "Member";
10080
    String completeBehind = "fo";
10406
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10081
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10407
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10082
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10408
10083
10409
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10084
    assertResults(
10410
    	assertResults(
10085
           "foo[METHOD_REF]{foo(), LCompletionAbstractMethod3$A;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED)+"}",
10411
	            "CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10086
           requestor.getResults());
10412
				"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10413
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10414
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10415
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10416
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10417
	            requestor.getResults());
10418
    } else {
10419
    	assertResults(
10420
	            "CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10421
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10422
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10423
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10424
	            requestor.getResults());
10425
    }
10426
}
10087
}
10427
public void testCompletionAllMemberTypes3() throws JavaModelException {
10088
public void testCompletionAbstractMethod4() throws JavaModelException {
10428
    this.wc = getWorkingCopy(
10089
	this.wc = getWorkingCopy(
10429
            "/Completion/src/test/CompletionAllMemberTypes2.java",
10090
            "/Completion/src/CompletionAbstractMethod4.java",
10430
            "package test;\n" +
10091
            "public class CompletionAbstractMethod1 {\n" +
10431
            "public interface CompletionAllMemberTypes2 {\n" +
10092
            "	class A {\n" +
10432
            "  interface Member1 {\n" +
10093
            "		void foo(){}\n" +
10433
            "    interface Member5 {\n" +
10094
            "	}\n" +
10434
            "      interface Member6 {\n" +
10095
            "	abstract class B extends A {\n" +
10435
            "      }\n" +
10096
            "		abstract void foo();\n" +
10436
            "    }\n" +
10097
            "	}\n" +
10437
            "    interface Member2 {\n" +
10098
            "	class C extends B {\n" +
10438
            "      interface Member3 {\n" +
10099
            "		void foo{} {}\n" +
10439
            "        interface Member4 {\n" +
10100
            "		void bar() {\n" +
10440
            "        }\n" +
10101
            "			super.fo\n" +
10441
            "      }\n" +
10102
            "		}\n" +
10442
            "        Member\n" +
10103
            "	}\n" +
10443
            "    }\n" +
10444
            "  \n}" +
10445
            "}");
10104
            "}");
10446
    
10105
    
10447
    
10106
    
10448
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10107
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10449
    String str = this.wc.getSource();
10108
    String str = this.wc.getSource();
10450
    String completeBehind = "Member";
10109
    String completeBehind = "fo";
10451
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10110
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10452
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10111
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10453
10112
10454
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10113
    assertResults(
10455
    	assertResults(
10114
           "",
10456
	            "Member[POTENTIAL_METHOD_DECLARATION]{Member, Ltest.CompletionAllMemberTypes2$Member1$Member2;, ()V, Member, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10115
           requestor.getResults());
10457
				"CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10458
				"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10459
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10460
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10461
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10462
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10463
	            requestor.getResults());
10464
    } else {
10465
    	assertResults(
10466
	            "Member[POTENTIAL_METHOD_DECLARATION]{Member, Ltest.CompletionAllMemberTypes2$Member1$Member2;, ()V, Member, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10467
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10468
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10469
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10470
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10471
	            requestor.getResults());
10472
    }
10473
}
10116
}
10474
public void testCompletionAllMemberTypes4() throws JavaModelException {
10117
public void testCompletionStaticMethodDeclaration1() throws JavaModelException {
10475
	ICompilationUnit anInterface = null;
10118
	ICompilationUnit aType = null;
10476
	try {
10119
	try {
10477
		anInterface = getWorkingCopy(
10120
		aType = getWorkingCopy(
10478
	            "/Completion/src/test/AnInterface.java",
10121
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10479
	            "package test;\n" +
10122
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10480
	            "public interface AnInterface {\n" +
10123
	            "	public static void foo(){}\n"+
10481
	            "  public interface Member1 {\n" +
10124
	            "	public void foo0(){}\n"+
10482
	            "    public interface Member5 {\n" +
10125
	            "}");
10483
	            "      public interface Member6 {\n" +
10126
		
10484
	            "      }\n" +
10127
		this.wc = getWorkingCopy(
10485
	            "    }\n" +
10128
	            "/Completion/src/CompletionStaticMethodDeclaration1.java",
10486
	            "    public interface Member2 {\n" +
10129
	            "public class CompletionStaticMethodDeclaration1 extends TypeWithAMethodAndAStaticMethod {\n"+
10487
	            "      public interface Member3 {\n" +
10130
	            "	foo\n"+
10488
	            "        interface Member4 {\n" +
10489
	            "        }\n" +
10490
	            "      }\n" +
10491
	            "        Member\n" +
10492
	            "    }\n" +
10493
	            "  \n}" +
10494
	            "}");
10495
		
10496
	    this.wc = getWorkingCopy(
10497
	            "/Completion/src/test/CompletionAllMemberTypes2.java",
10498
	            "package test;\n" +
10499
	            "public class CompletionAllMemberTypes2 {\n" +
10500
	            "  class Member1 {\n" +
10501
	            "    class Member5 {\n" +
10502
	            "      class Member6 {\n" +
10503
	            "      }\n" +
10504
	            "    }\n" +
10505
	            "    class Member2 implements AnInterface {\n" +
10506
	            "      class Member3 {\n" +
10507
	            "        class Member4 {\n" +
10508
	            "        }\n" +
10509
	            "      }\n" +
10510
	            "      void foo(){\n" +
10511
	            "        Member\n" +
10512
	            "      }\n" +
10513
	            "    }\n" +
10514
	            "  \n}" +
10515
	            "}");
10131
	            "}");
10516
	    
10132
	    
10517
	    
10133
	    
10518
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10134
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10519
	    String str = this.wc.getSource();
10135
	    String str = this.wc.getSource();
10520
	    String completeBehind = "Member";
10136
	    String completeBehind = "foo";
10521
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10137
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10522
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10138
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10523
	
10139
	
10524
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10140
		assertResults(
10525
	    	assertResults(
10141
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10526
		            "AnInterface.Member1.Member2[TYPE_REF]{test.AnInterface.Member1.Member2, test, Ltest.AnInterface$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10142
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10527
					"AnInterface.Member1.Member2.Member3[TYPE_REF]{test.AnInterface.Member1.Member2.Member3, test, Ltest.AnInterface$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10143
				requestor.getResults());
10528
					"AnInterface.Member1.Member2.Member3.Member4[TYPE_REF]{test.AnInterface.Member1.Member2.Member3.Member4, test, Ltest.AnInterface$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10529
					"AnInterface.Member1.Member5[TYPE_REF]{test.AnInterface.Member1.Member5, test, Ltest.AnInterface$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10530
					"AnInterface.Member1.Member5.Member6[TYPE_REF]{test.AnInterface.Member1.Member5.Member6, test, Ltest.AnInterface$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10531
					"CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10532
					"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10533
					"AnInterface.Member1[TYPE_REF]{Member1, test, Ltest.AnInterface$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10534
					"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10535
					"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10536
					"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10537
					"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10538
		            requestor.getResults());
10539
	    } else {
10540
	    	assertResults(
10541
		            "AnInterface.Member1[TYPE_REF]{Member1, test, Ltest.AnInterface$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10542
					"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10543
					"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10544
					"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10545
					"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10546
		            requestor.getResults());
10547
	    }
10548
	} finally {
10144
	} finally {
10549
		if(anInterface != null) {
10145
		if(aType != null) {
10550
			anInterface.discardWorkingCopy();
10146
			aType.discardWorkingCopy();
10551
		}
10147
		}
10552
	}
10148
	}
10553
}
10149
}
10554
public void testCompletionAllMemberTypes5() throws JavaModelException {
10150
public void testCompletionStaticMethodDeclaration2() throws JavaModelException {
10555
	ICompilationUnit aType = null;
10151
	ICompilationUnit aType = null;
10556
	Hashtable oldCurrentOptions = JavaCore.getOptions();
10557
	try {
10152
	try {
10558
		Hashtable options = new Hashtable(oldCurrentOptions);
10559
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
10560
		JavaCore.setOptions(options);
10561
		
10562
		aType = getWorkingCopy(
10153
		aType = getWorkingCopy(
10563
	            "/Completion/src/test/AType.java",
10154
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10564
	            "package test;\n" +
10155
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10565
	            "public class AType {\n" +
10156
	            "	public static void foo(){}\n"+
10566
	            "  public class Member1 {\n" +
10157
	            "	public void foo0(){}\n"+
10567
	            "    private class Member2 {\n" +
10568
	            "      public class Member3 {\n" +
10569
	            "        public class Member4 {\n" +
10570
	            "        }\n" +
10571
	            "      }\n" +
10572
	            "    }\n" +
10573
	            "  \n}" +
10574
	            "}");
10158
	            "}");
10575
		
10159
			
10576
	    this.wc = getWorkingCopy(
10160
		this.wc = getWorkingCopy(
10577
	            "/Completion/src/test/CompletionAllMemberTypes5.java",
10161
	            "/Completion/src/CompletionStaticMethodDeclaration2.java",
10578
	            "package test;\n" +
10162
	            "public class CompletionStaticMethodDeclaration2 {\n" +
10579
	            "public class CompletionAllMemberTypes5 {\n" +
10163
	            "	class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" +
10580
	            "  void foo(){\n" +
10164
	            "		foo\n" +
10581
	            "    Member\n" +
10165
	            "	}\n" +
10582
	            "  }\n" +
10583
	            "}");
10166
	            "}");
10584
	    
10167
	    
10585
	    
10168
	    
10586
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10169
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10587
	    String str = this.wc.getSource();
10170
	    String str = this.wc.getSource();
10588
	    String completeBehind = "Member";
10171
	    String completeBehind = "foo";
10589
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10172
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10590
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10173
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10591
	
10174
	
10592
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10175
		assertResults(
10593
	    	// AType.Member1.Member2.Member3 and AType.Member1.Member2.Member3.Member4 should not be proposed because they are not visible.
10176
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration2$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10594
	    	// But visibility need modifiers of enclosing types to be computed. 
10177
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10595
	    	assertResults(
10178
				requestor.getResults());
10596
		            "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10597
					"AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10598
					"AType.Member1.Member2.Member3.Member4[TYPE_REF]{test.AType.Member1.Member2.Member3.Member4, test, Ltest.AType$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10599
		            requestor.getResults());
10600
	    } else {
10601
	    	assertResults(
10602
		            "",
10603
		            requestor.getResults());
10604
	    }
10605
	} finally {
10179
	} finally {
10606
		if(aType != null) {
10180
		if(aType != null) {
10607
			aType.discardWorkingCopy();
10181
			aType.discardWorkingCopy();
10608
		}
10182
		}
10609
		JavaCore.setOptions(oldCurrentOptions);
10610
	}
10183
	}
10611
}
10184
}
10612
public void testCompletionAllMemberTypes6() throws JavaModelException {
10185
public void testCompletionStaticMethodDeclaration3() throws JavaModelException {
10613
	Hashtable oldCurrentOptions = JavaCore.getOptions();
10186
	ICompilationUnit aType = null;
10614
	try {
10187
	try {
10615
		Hashtable options = new Hashtable(oldCurrentOptions);
10188
		aType = getWorkingCopy(
10616
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
10189
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10617
		JavaCore.setOptions(options);
10190
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10618
		
10191
	            "	public static void foo(){}\n"+
10619
	    this.wc = getWorkingCopy(
10192
	            "	public void foo0(){}\n"+
10620
	            "/Completion/src/test/CompletionAllMemberTypes6.java",
10193
	            "}");
10621
	            "package test;\n" +
10194
			
10622
	            "class AType {\n" +
10195
		this.wc = getWorkingCopy(
10623
	            "  public class Member1 {\n" +
10196
	            "/Completion/src/CompletionStaticMethodDeclaration3.java",
10624
	            "    private class Member2 {\n" +
10197
	            "public class CompletionStaticMethodDeclaration3 {\n" +
10625
	            "      public class Member3 {\n" +
10198
	            "	static class Inner1 extends TypeWithAMethodAndAStaticMethod {\n" +
10626
	            "      }\n" +
10199
	            "		foo\n" +
10627
	            "    }\n" +
10200
	            "	}\n" +
10628
	            "  }\n" +
10629
	            "}\n" +
10630
	            "public class CompletionAllMemberTypes6 {\n" +
10631
	            "  void foo(){\n" +
10632
	            "    Member\n" +
10633
	            "  }\n" +
10634
	            "}");
10201
	            "}");
10635
	    
10202
	    
10636
	    
10203
	    
10637
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10204
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10638
	    String str = this.wc.getSource();
10205
	    String str = this.wc.getSource();
10639
	    String completeBehind = "Member";
10206
	    String completeBehind = "foo";
10640
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10207
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10641
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10208
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10642
	
10209
	
10643
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10210
		assertResults(
10644
	    	assertResults(
10211
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LCompletionStaticMethodDeclaration3$Inner1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10645
		            "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10212
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10646
		            requestor.getResults());
10213
				requestor.getResults());
10647
	    } else {
10648
	    	assertResults(
10649
		            "",
10650
		            requestor.getResults());
10651
	    }
10652
	} finally {
10214
	} finally {
10653
		JavaCore.setOptions(oldCurrentOptions);
10215
		if(aType != null) {
10216
			aType.discardWorkingCopy();
10217
		}
10654
	}
10218
	}
10655
}
10219
}
10656
public void testCompletionAllMemberTypes7() throws JavaModelException {
10220
public void testCompletionStaticMethodDeclaration4() throws JavaModelException {
10657
	Hashtable oldCurrentOptions = JavaCore.getOptions();
10221
	ICompilationUnit aType = null;
10658
	try {
10222
	try {
10659
		Hashtable options = new Hashtable(oldCurrentOptions);
10223
		aType = getWorkingCopy(
10660
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
10224
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10661
		JavaCore.setOptions(options);
10225
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10662
		
10226
	            "	public static void foo(){}\n"+
10663
	    this.wc = getWorkingCopy(
10227
	            "	public void foo0(){}\n"+
10664
	            "/Completion/src/test/AType.java",
10228
	            "}");
10665
	            "package test;\n" +
10229
			
10666
	            "class AType {\n" +
10230
		this.wc = getWorkingCopy(
10667
	            "  public class Member1 {\n" +
10231
	            "/Completion/src/CompletionStaticMethodDeclaration4.java",
10668
	            "    private class Member2 {\n" +
10232
	            "public class CompletionStaticMethodDeclaration4 {\n" +
10669
	            "      public class Member3 {\n" +
10233
	            "	void bar() {\n" +
10670
	            "      }\n" +
10234
	            "		class Local1 extends TypeWithAMethodAndAStaticMethod {\n" +
10671
	            "    }\n" +
10235
	            "			foo\n" +
10672
	            "  }\n" +
10236
	            "		}\n" +
10673
	            "  void foo(){\n" +
10237
	            "	}\n" +
10674
	            "    Member\n" +
10675
	            "  }\n" +
10676
	            "}");
10238
	            "}");
10677
	    
10239
	    
10678
	    
10240
	    
10679
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10241
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10680
	    String str = this.wc.getSource();
10242
	    String str = this.wc.getSource();
10681
	    String completeBehind = "Member";
10243
	    String completeBehind = "foo";
10682
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10244
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10683
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10245
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10684
	
10246
	
10685
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
10247
		assertResults(
10686
	    	assertResults(
10248
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10687
		            "AType.Member1.Member2[TYPE_REF]{test.AType.Member1.Member2, test, Ltest.AType$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10249
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10688
					"AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10250
				requestor.getResults());
10689
					"AType.Member1[TYPE_REF]{Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10690
		            requestor.getResults());
10691
	    } else {
10692
	    	assertResults(
10693
		            "AType.Member1[TYPE_REF]{Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10694
		            requestor.getResults());
10695
	    }
10696
	} finally {
10251
	} finally {
10697
		JavaCore.setOptions(oldCurrentOptions);
10252
		if(aType != null) {
10253
			aType.discardWorkingCopy();
10254
		}
10698
	}
10255
	}
10699
}
10256
}
10700
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=96213
10257
public void testCompletionStaticMethodDeclaration5() throws JavaModelException {
10701
public void testBug96213() throws JavaModelException {
10702
    this.wc = getWorkingCopy(
10703
            "/Completion/src/test/Test.java",
10704
            "package test;\n" +
10705
            "public class Test{\n"+
10706
            "  Test toto(Object o) {\n"+
10707
            "    return null;\n"+
10708
            "  }\n"+
10709
            "  void titi(int removed) {\n"+
10710
            "  }\n"+
10711
            "  void foo() {\n"+
10712
            "    int removed = 0;\n"+
10713
            "    toto(Test.this).titi(removed);\n"+
10714
            "  }\n"+
10715
            "}");
10716
    
10717
    
10718
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10719
    String str = this.wc.getSource();
10720
    String completeBehind = "removed";
10721
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10722
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10723
10724
	assertResults(
10725
            "removed[LOCAL_VARIABLE_REF]{removed, null, I, removed, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10726
            requestor.getResults());
10727
}
10728
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95167
10729
public void testCompletionWithProblem1() throws JavaModelException {
10730
	ICompilationUnit aType = null;
10258
	ICompilationUnit aType = null;
10731
	try {
10259
	try {
10732
		aType = getWorkingCopy(
10260
		aType = getWorkingCopy(
10733
	            "/Completion/src/test/AType.java",
10261
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10734
	            "package test;\n" +
10262
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10735
	            "public class AType{\n"+
10263
	            "	public static void foo(){}\n"+
10736
	            "  void foo(Unknown var) {\n"+
10264
	            "	public void foo0(){}\n"+
10737
	            "  }\n"+
10738
	            "}");
10265
	            "}");
10739
		
10266
			
10740
	    this.wc = getWorkingCopy(
10267
		this.wc = getWorkingCopy(
10741
	            "/Completion/src/test/Test.java",
10268
	            "/Completion/src/CompletionStaticMethodDeclaration5.java",
10742
	            "package test;\n" +
10269
	            "public class CompletionStaticMethodDeclaration5 {\n"+
10743
	            "public class Test{\n"+
10270
	            "	void bar() {\n"+
10744
	            "  void foo() {\n"+
10271
	            "		static class Local1 extends TypeWithAMethodAndAStaticMethod {\n"+
10745
	            "    AType a = null;\n"+
10272
	            "			foo\n"+
10746
	            "    a.zz\n"+
10273
	            "		}\n"+
10747
	            "  }\n"+
10274
	            "	}\n"+
10748
	            "}");
10275
	            "}");
10749
	    
10276
	    
10750
	    
10277
	    
10751
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10278
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10752
	    String str = this.wc.getSource();
10279
	    String str = this.wc.getSource();
10753
	    String completeBehind = "a.zz";
10280
	    String completeBehind = "foo";
10754
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10281
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10755
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10282
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10756
	
10283
	
10757
	    // no completion must be found
10758
		assertResults(
10759
	            "",
10760
	            requestor.getResults());
10761
		
10762
		// no error must be found
10763
		assertResults(
10284
		assertResults(
10764
	            "",
10285
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LLocal1;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10765
	            requestor.getProblem());
10286
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10287
				requestor.getResults());
10766
	} finally {
10288
	} finally {
10767
		if(aType != null) {
10289
		if(aType != null) {
10768
			aType.discardWorkingCopy();
10290
			aType.discardWorkingCopy();
10769
		}
10291
		}
10770
	}
10292
	}
10771
}
10293
}
10772
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
10294
public void testCompletionStaticMethodDeclaration6() throws JavaModelException {
10773
public void testCompletionExpectedTypeOnEmptyToken1() throws JavaModelException {
10774
	ICompilationUnit aType = null;
10295
	ICompilationUnit aType = null;
10775
	try {
10296
	try {
10776
		
10777
		aType = getWorkingCopy(
10297
		aType = getWorkingCopy(
10778
	            "/Completion/src/test/AType.java",
10298
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10779
	            "package test;\n" +
10299
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10780
	            "public class AType{\n"+
10300
	            "	public static void foo(){}\n"+
10301
	            "	public void foo0(){}\n"+
10781
	            "}");
10302
	            "}");
10782
		
10303
			
10783
	    this.wc = getWorkingCopy(
10304
		this.wc = getWorkingCopy(
10784
	            "/Completion/src/test/Test.java",
10305
	            "/Completion/src/CompletionStaticMethodDeclaration6.java",
10785
	            "package test;\n" +
10306
	            "public class CompletionStaticMethodDeclaration6 {\n"+
10786
	            "public class Test{\n"+
10307
	            "	void bar() {\n"+
10787
	            "  void foo() {\n"+
10308
	            "		new TypeWithAMethodAndAStaticMethod() {\n"+
10788
	            "    AType a = new \n"+
10309
	            "			foo\n"+
10789
	            "  }\n"+
10310
	            "		};\n"+
10311
	            "	}\n"+
10790
	            "}");
10312
	            "}");
10791
	    
10313
	    
10792
	    
10314
	    
10793
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10315
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10794
	    String str = this.wc.getSource();
10316
	    String str = this.wc.getSource();
10795
	    String completeBehind = "AType a = new ";
10317
	    String completeBehind = "foo";
10796
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10318
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10797
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10319
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10798
	
10320
	
10799
	    assertResults(
10321
		assertResults(
10800
	            "expectedTypesSignatures={Ltest.AType;}\n"+
10322
				"foo[POTENTIAL_METHOD_DECLARATION]{foo, LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10801
	            "expectedTypesKeys={Ltest/AType;}",
10323
				"foo0[METHOD_DECLARATION]{public void foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_NON_RESTRICTED) + "}",
10802
	            requestor.getContext());
10324
				requestor.getResults());
10803
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10804
			assertResults(
10805
		            "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10806
		            requestor.getResults());
10807
	    } else {
10808
	    	assertResults(
10809
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10810
					"AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10811
		            requestor.getResults());
10812
	    }
10813
	} finally {
10325
	} finally {
10814
		if(aType != null) {
10326
		if(aType != null) {
10815
			aType.discardWorkingCopy();
10327
			aType.discardWorkingCopy();
10816
		}
10328
		}
10817
	}
10329
	}
10818
}
10330
}
10819
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
10331
public void testCompletionStaticMethod1() throws JavaModelException {
10820
public void testCompletionExpectedTypeOnEmptyToken3() throws JavaModelException {
10821
	ICompilationUnit aType = null;
10332
	ICompilationUnit aType = null;
10822
	try {
10333
	try {
10823
		aType = getWorkingCopy(
10334
		aType = getWorkingCopy(
10824
	            "/Completion/src/test/AType.java",
10335
	            "/Completion/src/TypeWithAMethodAndAStaticMethod .java",
10825
	            "package test;\n" +
10336
	            "public class TypeWithAMethodAndAStaticMethod {\n"+
10826
	            "public class AType{\n"+
10337
	            "	public static void foo(){}\n"+
10338
	            "	public void foo0(){}\n"+
10827
	            "}");
10339
	            "}");
10828
		
10340
			
10829
	    this.wc = getWorkingCopy(
10341
		this.wc = getWorkingCopy(
10830
	            "/Completion/src/test/Test.java",
10342
	            "/Completion/src/CompletionStaticMethod1.java",
10831
	            "package test;\n" +
10343
	            "public class CompletionStaticMethod1 extends TypeWithAMethodAndAStaticMethod {\n"+
10832
	            "public class Test{\n"+
10344
	            "	void bar(){\n"+
10833
	            "  void foo() {\n"+
10345
	            "		new TypeWithAMethodAndAStaticMethod(){\n"+
10834
	            "    AType a = \n"+
10346
	            "			class Inner1 extends TypeWithAMethodAndAStaticMethod {\n"+
10835
	            "  }\n"+
10347
	            "				void bar(){\n"+
10348
	            "					foo\n"+
10349
	            "				}\n"+
10350
	            "			}\n"+
10351
	            "		};\n"+
10352
	            "	}\n"+
10353
	            "	\n"+
10836
	            "}");
10354
	            "}");
10837
	    
10355
	    
10838
	    
10356
	    
10839
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10357
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10840
	    requestor.setIgnored(CompletionProposal.METHOD_REF, true);
10841
	    requestor.setIgnored(CompletionProposal.FIELD_REF, true);
10842
	    requestor.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true);
10843
	    
10844
	    String str = this.wc.getSource();
10358
	    String str = this.wc.getSource();
10845
	    String completeBehind = "AType a = ";
10359
	    String completeBehind = "foo";
10846
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10360
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10847
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10361
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10848
	
10362
	
10849
	    assertResults(
10363
		assertResults(
10850
	            "expectedTypesSignatures={Ltest.AType;}\n"+
10364
				"foo0[METHOD_REF]{CompletionStaticMethod1.this.foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10851
	            "expectedTypesKeys={Ltest/AType;}",
10365
				"foo0[METHOD_REF]{foo0(), LTypeWithAMethodAndAStaticMethod;, ()V, foo0, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED) + "}\n" +
10852
	            requestor.getContext());
10366
				"foo[METHOD_REF]{CompletionStaticMethod1.foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" +
10853
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10367
				"foo[METHOD_REF]{foo(), LTypeWithAMethodAndAStaticMethod;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
10854
			assertResults(
10368
				requestor.getResults());
10855
		            "",
10856
		            requestor.getResults());
10857
	    } else {
10858
	    	assertResults(
10859
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10860
					"AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10861
		            requestor.getResults());
10862
	    }
10863
	} finally {
10369
	} finally {
10864
		if(aType != null) {
10370
		if(aType != null) {
10865
			aType.discardWorkingCopy();
10371
			aType.discardWorkingCopy();
10866
		}
10372
		}
10867
	}
10373
	}
10868
}
10374
}
10869
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
10375
public void testCompletionAfterSwitch() throws JavaModelException {
10870
public void testCompletionExpectedTypeOnEmptyToken4() throws JavaModelException {
10376
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10871
	ICompilationUnit aType = null;
10377
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSwitch.java");
10872
	try {
10378
10873
		aType = getWorkingCopy(
10379
	String str = cu.getSource();
10874
	            "/Completion/src/test/AInterface.java",
10380
	String completeBehind = "bar";
10875
	            "package test;\n" +
10381
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10876
	            "public interface AInterface{\n"+
10382
	cu.codeComplete(cursorLocation, requestor);
10877
	            "}");
10383
10878
		
10384
	assertEquals(
10879
	    this.wc = getWorkingCopy(
10385
			"element:bar    completion:bar()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_NAME+ R_NON_RESTRICTED),
10880
	            "/Completion/src/test/Test.java",
10386
			requestor.getResults());
10881
	            "package test;\n" +
10387
}
10882
	            "public class Test{\n"+
10388
public void testCompletionAfterSupercall1() throws JavaModelException {
10883
	            "  void foo() {\n"+
10389
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10884
	            "    AInterface a = new \n"+
10390
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSupercall1.java");
10885
	            "  }\n"+
10391
10886
	            "}");
10392
	String str = cu.getSource();
10887
	    
10393
	String completeBehind = "super.foo";
10888
	    
10394
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10889
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10395
	cu.codeComplete(cursorLocation, requestor);
10890
	    
10396
10891
	    String str = this.wc.getSource();
10397
	assertEquals(
10892
	    String completeBehind = "AInterface a = new ";
10398
			"element:foo    completion:foo()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED),
10893
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10399
			requestor.getResults());
10894
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10400
}
10895
	
10401
public void testCompletionPackageAndClass1() throws JavaModelException {
10896
	    assertResults(
10402
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10897
	            "expectedTypesSignatures={Ltest.AInterface;}\n"+
10403
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Qla3.java");
10898
	            "expectedTypesKeys={Ltest/AInterface;}",
10404
10899
	            requestor.getContext());
10405
	String str = cu.getSource();
10900
	    
10406
	String completeBehind = "z1.z2.ql";
10901
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
10407
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10902
			assertResults(
10408
	cu.codeComplete(cursorLocation, requestor);
10903
		            "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10409
10904
		            requestor.getResults());
10410
	assertEquals(
10905
	    } else {
10411
			"element:Qla1    completion:z1.z2.Qla1    relevance:" + (R_DEFAULT + R_INTERESTING + R_QUALIFIED + R_NON_RESTRICTED) + "\n" +
10906
	    	assertResults(
10412
			"element:qla2    completion:z1.z2.qla2    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "\n" +
10907
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10413
			"element:z1.z2.qla0    completion:z1.z2.qla0    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED+ R_NON_RESTRICTED),
10908
					"AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10414
			requestor.getResults());
10909
		            requestor.getResults());
10415
}
10910
	    }
10416
public void testCompletionPackageAndClass2() throws JavaModelException {
10911
	} finally {
10417
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10912
		if(aType != null) {
10418
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "z1.z2.qla0", "Wla.java");
10913
			aType.discardWorkingCopy();
10419
10914
		}
10420
	String str = cu.getSource();
10915
	}
10421
	String completeBehind = "z1.z2.qla0.";
10422
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10423
	cu.codeComplete(cursorLocation, requestor);
10424
10425
	assertEquals(
10426
			"element:Qla3    completion:Qla3    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
10427
			"element:Qla4    completion:Qla4    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
10428
			"element:Wla    completion:Wla    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED),
10429
			requestor.getResults());
10430
}
10431
public void testCompletionNonStaticFieldRelevance() throws JavaModelException {
10432
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10433
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionNonStaticFieldRelevance.java");
10434
10435
	String str = cu.getSource();
10436
	String completeBehind = "var.Ii";
10437
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10438
	cu.codeComplete(cursorLocation, requestor);
10439
10440
	assertEquals(
10441
			"element:Ii0    completion:Ii0    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "\n" +
10442
			"element:ii1    completion:ii1    relevance:" + (R_DEFAULT + R_INTERESTING + R_NON_STATIC+ R_NON_RESTRICTED),
10443
			requestor.getResults());
10444
}
10445
public void testCompletionInsideStaticMethod() throws JavaModelException {
10446
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10447
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionInsideStaticMethod.java");
10448
10449
	String str = cu.getSource();
10450
	String completeBehind = "doT";
10451
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10452
	cu.codeComplete(cursorLocation, requestor);
10453
10454
	assertEquals(
10455
			"element:doTheThing    completion:doTheThing()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED+ R_NON_RESTRICTED),
10456
			requestor.getResults());
10457
}
10458
/*
10459
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65737
10460
 */
10461
public void testCompletion2InterfacesWithSameMethod() throws JavaModelException {
10462
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10463
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "Completion2InterfacesWithSameMethod.java");
10464
10465
	String str = cu.getSource();
10466
	String completeBehind = "var.meth";
10467
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10468
	cu.codeComplete(cursorLocation, requestor);
10469
10470
	assertEquals(
10471
			"element:method    completion:method()    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC+ R_NON_RESTRICTED),
10472
			requestor.getResults());
10473
}
10474
/*
10475
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66570
10476
 */
10477
public void testCompletionExactNameCaseInsensitive() throws JavaModelException {
10478
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10479
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionExactNameCaseInsensitive.java");
10480
10481
	String str = cu.getSource();
10482
	String completeBehind = "(compleTionexactnamecaseInsensitive";
10483
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10484
	cu.codeComplete(cursorLocation, requestor);
10485
10486
	assertEquals(
10487
			"element:CompletionExactNameCaseInsensitive    completion:CompletionExactNameCaseInsensitive    relevance:"+(R_DEFAULT + R_INTERESTING + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+ "\n" +
10488
			"element:CompletionExactNameCaseInsensitivePlus    completion:CompletionExactNameCaseInsensitivePlus    relevance:"+(R_DEFAULT + R_INTERESTING + R_UNQUALIFIED+ R_NON_RESTRICTED),
10489
			requestor.getResults());
10490
}
10491
/*
10492
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66908
10493
 */
10494
public void testCompletionSameClass() throws JavaModelException {
10495
	CompletionTestsRequestor requestor = new CompletionTestsRequestor();
10496
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionSameClass.java");
10497
10498
	String str = cu.getSource();
10499
	String completeBehind = "(CompletionSameClas";
10500
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10501
	cu.codeComplete(cursorLocation, requestor);
10502
10503
	assertEquals(
10504
			"element:CompletionSameClass    completion:CompletionSameClass    relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED),
10505
			requestor.getResults());
10506
}
10507
public void testCompletionBasicPackage1() throws JavaModelException {
10508
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10509
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPackage1.java");
10510
10511
	String str = cu.getSource();
10512
	String completeBehind = "java.lan";
10513
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10514
	cu.codeComplete(cursorLocation, requestor);
10515
10516
	assertResults(
10517
			"java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_QUALIFIED + R_NON_RESTRICTED) + "}",
10518
			requestor.getResults());
10916
}
10519
}
10917
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=99811
10520
public void testCompletionBasicType1() throws JavaModelException {
10918
public void testBug99811() throws JavaModelException {
10521
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10919
	ICompilationUnit aType = null;
10522
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicType1.java");
10920
    try {
10523
10921
    	this.wc = getWorkingCopy(
10524
	String str = cu.getSource();
10922
	            "/Completion/src/test/A.java",
10525
	String completeBehind = "Objec";
10923
	            "public abstract class A implements I {}");
10526
	int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
10924
    	
10527
	cu.codeComplete(cursorLocation, requestor);
10925
	    aType = getWorkingCopy(
10528
10926
	            "/Completion/src/test/I.java",
10529
	assertResults(
10927
	            "public interface I {\n"+
10530
			"Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10928
	            "  public class M extends A {}\n"+
10531
			requestor.getResults());
10929
	            "}");
10930
	
10931
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10932
	    String str = this.wc.getSource();
10933
	    String completeBehind = "A";
10934
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10935
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10936
	
10937
		assertResults("", requestor.getResults());
10938
	} finally {
10939
		if(aType != null) {
10940
			aType.discardWorkingCopy();
10941
		}
10942
	}
10943
}
10532
}
10944
public void testCompletionImportedType1() throws JavaModelException {
10533
public void testCompletionBasicField1() throws JavaModelException {
10945
    this.workingCopies = new ICompilationUnit[2];
10534
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10946
    this.workingCopies[0] = getWorkingCopy(
10535
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicField1.java");
10947
		"/Completion/src/test/imported/ZZZZ.java",
10948
		"package test.imported;"+
10949
		"public class ZZZZ {\n"+
10950
		"  \n"+
10951
		"}");
10952
		
10953
	this.workingCopies[1] = getWorkingCopy(
10954
			"/Completion/src/test/CompletionImportedType1.java",
10955
			"package test;"+
10956
			"public class CompletionImportedType1 {"+
10957
			"  ZZZ\n"+
10958
			"}");
10959
10536
10960
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10537
	String str = cu.getSource();
10961
	String str = this.workingCopies[1].getSource();
10538
	String completeBehind = "zzvar";
10962
	String completeBehind = "ZZZ";
10963
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10539
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10964
	this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner);
10540
	cu.codeComplete(cursorLocation, requestor);
10965
10541
10966
	assertResults(
10542
	assertResults(
10967
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType1;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10543
			"zzvarzz[FIELD_REF]{zzvarzz, LCompletionBasicField1;, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10968
			"ZZZZ[TYPE_REF]{test.imported.ZZZZ, test.imported, Ltest.imported.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10969
			requestor.getResults());
10544
			requestor.getResults());
10970
}
10545
}
10971
public void testCompletionImportedType2() throws JavaModelException {
10546
public void testCompletionBasicMethod1() throws JavaModelException {
10972
	this.workingCopies = new ICompilationUnit[4];
10547
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10973
	this.workingCopies[0] = getWorkingCopy(
10548
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethod1.java");
10974
		"/Completion/src/test/imported1/ZZZZ.java",
10549
10975
		"package test.imported1;"+
10550
	String str = cu.getSource();
10976
		"public class ZZZZ {\n"+
10551
	String completeBehind = "zzfo";
10977
		"  \n"+
10978
		"}");
10979
	this.workingCopies[1] = getWorkingCopy(
10980
		"/Completion/src/test/imported2/ZZZZ.java",
10981
		"package test.imported2;"+
10982
		"public class ZZZZ {\n"+
10983
		"  \n"+
10984
		"}");
10985
	this.workingCopies[2] = getWorkingCopy(
10986
		"/Completion/src/test/imported3/ZZZZ.java",
10987
		"package test.imported3;"+
10988
		"public class ZZZZ {\n"+
10989
		"  \n"+
10990
		"}");
10991
	
10992
	this.workingCopies[3] = getWorkingCopy(
10993
		"/Completion/src/test/CompletionImportedType2.java",
10994
		"package test;"+
10995
		"import test.imported1.*;"+
10996
		"import test.imported2.*;"+
10997
		"import test.imported3.*;"+
10998
		"public class CompletionImportedType2 {"+
10999
		"  ZZZ\n"+
11000
		"}");
11001
	
11002
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11003
	String str = this.workingCopies[3].getSource();
11004
	String completeBehind = "ZZZ";
11005
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10552
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11006
	this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner);
10553
	cu.codeComplete(cursorLocation, requestor);
11007
10554
11008
	assertResults(
10555
	assertResults(
11009
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType2;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10556
			"zzfoo[METHOD_REF]{zzfoo(), LCompletionBasicMethod1;, ()V, zzfoo, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11010
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11011
			"ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11012
			"ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11013
			requestor.getResults());
10557
			requestor.getResults());
11014
}
10558
}
11015
public void testCompletionImportedType3() throws JavaModelException {
10559
public void testCompletionBasicLocalVariable1() throws JavaModelException {
11016
	this.workingCopies = new ICompilationUnit[4];
10560
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10561
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicLocalVariable1.java");
10562
10563
	String str = cu.getSource();
10564
	String completeBehind = "zzvar";
10565
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10566
	cu.codeComplete(cursorLocation, requestor);
10567
10568
	assertResults(
10569
			"zzvarzz[LOCAL_VARIABLE_REF]{zzvarzz, null, I, zzvarzz, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10570
			requestor.getResults());
10571
}
10572
public void testCompletionBasicKeyword1() throws JavaModelException {
10573
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10574
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicKeyword1.java");
10575
10576
	String str = cu.getSource();
10577
	String completeBehind = "whil";
10578
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10579
	cu.codeComplete(cursorLocation, requestor);
10580
10581
	assertResults(
10582
			"while[KEYWORD]{while, null, null, while, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10583
			requestor.getResults());
10584
}
10585
public void testCompletionBasicVariableDeclaration1() throws JavaModelException {
10586
	this.workingCopies = new ICompilationUnit[1];
11017
	this.workingCopies[0] = getWorkingCopy(
10587
	this.workingCopies[0] = getWorkingCopy(
11018
		"/Completion/src/test/imported1/ZZZZ.java",
10588
		"/Completion/src/CompletionBasicVariableDeclaration1.java",
11019
		"package test.imported1;"+
10589
		"public class CompletionBasicVariableDeclaration1 {\n"+
11020
		"public class ZZZZ {\n"+
10590
		"	public Object obj;\n"+
11021
		"  \n"+
10591
		"}\n");
11022
		"}");
11023
	this.workingCopies[1] = getWorkingCopy(
11024
		"/Completion/src/test/imported2/ZZZZ.java",
11025
		"package test.imported2;"+
11026
		"public class ZZZZ {\n"+
11027
		"  \n"+
11028
		"}");
11029
	this.workingCopies[2] = getWorkingCopy(
11030
		"/Completion/src/test/imported3/ZZZZ.java",
11031
		"package test.imported3;"+
11032
		"public class ZZZZ {\n"+
11033
		"  \n"+
11034
		"}");
11035
	
11036
	this.workingCopies[3] = getWorkingCopy(
11037
		"/Completion/src/test/CompletionImportedType3.java",
11038
		"package test;"+
11039
		"import test.imported2.*;"+
11040
		"public class CompletionImportedType3 {"+
11041
		"  ZZZ\n"+
11042
			"}");
11043
	
10592
	
11044
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10593
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11045
	String str = this.workingCopies[3].getSource();
10594
	String str = this.workingCopies[0].getSource();
11046
	String completeBehind = "ZZZ";
10595
	String completeBehind = "obj";
10596
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10597
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10598
	
10599
	assertResults(
10600
		"object[VARIABLE_DECLARATION]{object, null, Ljava.lang.Object;, object, null, " + (R_DEFAULT + R_INTERESTING + R_CASE+ R_NAME_LESS_NEW_CHARACTERS + R_NON_RESTRICTED) + "}",
10601
		requestor.getResults());
10602
}
10603
public void testCompletionBasicMethodDeclaration1() throws JavaModelException {
10604
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10605
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicMethodDeclaration1.java");
10606
10607
	String str = cu.getSource();
10608
	String completeBehind = "equals";
11047
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10609
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11048
	this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner);
10610
	cu.codeComplete(cursorLocation, requestor);
11049
10611
11050
	assertResults(
10612
	assertResults(
11051
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType3;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10613
			"equals[POTENTIAL_METHOD_DECLARATION]{equals, LCompletionBasicMethodDeclaration1;, ()V, equals, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11052
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10614
			"equals[METHOD_DECLARATION]{public boolean equals(Object obj), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_METHOD_OVERIDE + R_EXACT_NAME + R_NON_RESTRICTED) + "}",
11053
			"ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11054
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11055
			requestor.getResults());
10615
			requestor.getResults());
11056
}
10616
}
11057
public void testCompletionImportedType4() throws JavaModelException {
10617
public void testCompletionBasicAnonymousDeclaration1() throws JavaModelException {
11058
	this.workingCopies = new ICompilationUnit[3];
10618
	CompletionResult result = complete(
11059
	this.workingCopies[0] = getWorkingCopy(
10619
			"/Completion/src3/test0000/CompletionBasicCompletionContext.java",
11060
		"/Completion/src/test/imported1/ZZZZ.java",
10620
			"public class CompletionBasicAnonymousDeclaration1 {\n"+
11061
		"package test.imported1;"+
10621
			"	void foo() {\n"+
11062
		"public class ZZZZ {\n"+
10622
			"		new Object(\n"+
11063
		"  \n"+
10623
			"	}\n"+
11064
		"}");
10624
			"}",
11065
	this.workingCopies[1] = getWorkingCopy(
10625
			"new Object(");
11066
		"/Completion/src/test/imported2/ZZZZ.java",
11067
		"package test.imported2;"+
11068
		"public class ZZZZ {\n"+
11069
		"  \n"+
11070
		"}");
11071
		
11072
	this.workingCopies[2] = getWorkingCopy(
11073
		"/Completion/src/test/CompletionImportedType4.java",
11074
		"package test;"+
11075
		"import test.imported1.*;"+
11076
		"public class CompletionImportedType4 {"+
11077
		"  ZZZ\n"+
11078
		"}");
11079
	
10626
	
11080
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10627
	assertResults(
11081
	String str = this.workingCopies[2].getSource();
10628
			"expectedTypesSignatures=null\n" +
11082
	String completeBehind = "ZZZ";
10629
			"expectedTypesKeys=null",
10630
			result.context);
10631
	
10632
	assertResults(
10633
			"Object[ANONYMOUS_CLASS_DECLARATION]{, Ljava.lang.Object;, ()V, null, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10634
			"Object[METHOD_REF<CONSTRUCTOR>]{, Ljava.lang.Object;, ()V, Object, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
10635
			result.proposals);
10636
}
10637
public void testCompletionBasicCompletionContext() throws JavaModelException {
10638
	CompletionResult result = complete(
10639
			"/Completion/src3/test0000/CompletionBasicCompletionContext.java",
10640
			"package test0000;\n" +
10641
			"public class CompletionBasicCompletionContext {\n" +
10642
			"  void bar(String o) {\n" +
10643
			"    String zzz = null; \n" + 
10644
			"    o = zzz\n" + 
10645
			"  }\n" +
10646
			"}",
10647
			"zzz");
10648
	
10649
	assertResults(
10650
			"expectedTypesSignatures={Ljava.lang.String;}\n" +
10651
			"expectedTypesKeys={Ljava/lang/String;}",
10652
			result.context);
10653
	
10654
	assertResults(
10655
			"zzz[LOCAL_VARIABLE_REF]{zzz, null, Ljava.lang.String;, zzz, null, " + (R_DEFAULT + R_INTERESTING + R_CASE +  + R_EXACT_NAME + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10656
			result.proposals);
10657
}
10658
public void testCompletionBasicPotentialMethodDeclaration1() throws JavaModelException {
10659
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
10660
	ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionBasicPotentialMethodDeclaration1.java");
10661
10662
	String str = cu.getSource();
10663
	String completeBehind = "zzpot";
11083
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10664
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11084
	this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner);
10665
	cu.codeComplete(cursorLocation, requestor);
11085
10666
11086
	assertResults(
10667
	assertResults(
11087
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType4;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10668
			"zzpot[POTENTIAL_METHOD_DECLARATION]{zzpot, LCompletionBasicPotentialMethodDeclaration1;, ()V, zzpot, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}",
11088
			"ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11089
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11090
			requestor.getResults());
10669
			requestor.getResults());
11091
}
10670
}
11092
public void testCompletionImportedType5() throws JavaModelException {
10671
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82740
11093
	this.workingCopies = new ICompilationUnit[3];
10672
public void testCompletionInsideGenericClass() throws JavaModelException {
11094
	this.workingCopies[0] = getWorkingCopy(
10673
	this.wc = getWorkingCopy(
11095
		"/Completion/src/test/imported1/ZZZZ.java",
10674
			"/Completion/src/test/CompletionInsideGenericClass.java",
11096
		"package test.imported1;"+
10675
			"package test;\n" +
11097
		"public class ZZZZ {\n"+
10676
			"public class CompletionInsideGenericClass <CompletionInsideGenericClassParameter> {\n" +
11098
		"  \n"+
10677
			"  CompletionInsideGenericClas\n" +
11099
		"}");
10678
			"}");
11100
	this.workingCopies[1] = getWorkingCopy(
10679
	
11101
		"/Completion/src/test/imported2/ZZZZ.java",
10680
	
11102
		"package test.imported2;"+
11103
		"public class ZZZZ {\n"+
11104
		"  \n"+
11105
		"}");
11106
		
11107
	this.workingCopies[2] = getWorkingCopy(
11108
		"/Completion/src/test/CompletionImportedType5.java",
11109
		"package test;"+
11110
		"import test.imported2.*;"+
11111
		"public class CompletionImportedType5 {"+
11112
		"  ZZZ\n"+
11113
		"}");
11114
11115
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10681
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11116
	String str = this.workingCopies[2].getSource();
10682
	String str = this.wc.getSource();
11117
	String completeBehind = "ZZZ";
10683
	String completeBehind = "CompletionInsideGenericClas";
11118
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10684
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11119
	this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner);
10685
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11120
10686
11121
	assertResults(
10687
	assertResults(
11122
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType5;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10688
			"CompletionInsideGenericClas[POTENTIAL_METHOD_DECLARATION]{CompletionInsideGenericClas, Ltest.CompletionInsideGenericClass;, ()V, CompletionInsideGenericClas, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11123
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
10689
			"CompletionInsideGenericClass[TYPE_REF]{CompletionInsideGenericClass, test, Ltest.CompletionInsideGenericClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11124
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11125
			requestor.getResults());
10690
			requestor.getResults());
11126
}
10691
}
11127
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10692
11128
public void testCamelCaseType1() throws JavaModelException {
10693
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11129
	this.oldOptions = JavaCore.getOptions();
10694
public void testCompletionInsideExtends1() throws JavaModelException {
11130
	try {
10695
	this.wc = getWorkingCopy(
11131
		Hashtable options = new Hashtable(oldOptions);
10696
			"/Completion/src/test/CompletionInsideExtends1.java",
11132
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10697
			"package test;\n" +
11133
		JavaCore.setOptions(options);
10698
			"public class CompletionInsideExtends1 extends  {\n" +
11134
		
10699
			"  public class CompletionInsideExtends1Inner {}\n" +
11135
		this.workingCopies = new ICompilationUnit[3];
10700
			"}\n" +
11136
		this.workingCopies[0] = getWorkingCopy(
10701
			"class CompletionInsideExtends1TopLevel {\n" +
11137
			"/Completion/src/camelcase/Test.java",
11138
			"package camelcase;"+
11139
			"public class Test {\n"+
11140
			"  FF\n"+
11141
			"}");
11142
	
11143
		this.workingCopies[1] = getWorkingCopy(
11144
			"/Completion/src/camelcase/FoFoFo.java",
11145
			"package camelcase;"+
11146
			"public class FoFoFo {\n"+
11147
			"}");
11148
		
11149
		this.workingCopies[2] = getWorkingCopy(
11150
			"/Completion/src/camelcase/FFFTest.java",
11151
			"package camelcase;"+
11152
			"public class FFFTest {\n"+
11153
			"}");
10702
			"}");
11154
	
10703
	
11155
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11156
		String str = this.workingCopies[0].getSource();
11157
		String completeBehind = "FF";
11158
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11159
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11160
	
10704
	
10705
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10706
	String str = this.wc.getSource();
10707
	String completeBehind = "extends ";
10708
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10709
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10710
10711
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11161
		assertResults(
10712
		assertResults(
11162
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10713
				"",
11163
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10714
				requestor.getResults());
11164
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10715
	} else {
10716
		assertResults(
10717
				"CompletionInsideExtends1TopLevel[TYPE_REF]{CompletionInsideExtends1TopLevel, test, Ltest.CompletionInsideExtends1TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11165
				requestor.getResults());
10718
				requestor.getResults());
11166
	} finally {
11167
		JavaCore.setOptions(oldOptions);
11168
	}
10719
	}
10720
	
11169
}
10721
}
11170
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10722
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11171
public void testCamelCaseType2() throws JavaModelException {
10723
public void testCompletionInsideExtends2() throws JavaModelException {
11172
	this.oldOptions = JavaCore.getOptions();
10724
	this.wc = getWorkingCopy(
11173
	try {
10725
			"/Completion/src/test/CompletionInsideExtends2.java",
11174
		Hashtable options = new Hashtable(oldOptions);
10726
			"package test;\n" +
11175
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10727
			"public class CompletionInsideExtends2 extends CompletionInsideExtends {\n" +
11176
		JavaCore.setOptions(options);
10728
			"  public class CompletionInsideExtends2Inner {}\n" +
11177
		
10729
			"}\n" +
11178
		this.workingCopies = new ICompilationUnit[3];
10730
			"class CompletionInsideExtends2TopLevel {\n" +
11179
		this.workingCopies[0] = getWorkingCopy(
11180
			"/Completion/src/camelcase/Test.java",
11181
			"package camelcase;"+
11182
			"public class Test {\n"+
11183
			"  camelcase.FF\n"+
11184
			"}");
10731
			"}");
11185
	
10732
	
11186
		this.workingCopies[1] = getWorkingCopy(
10733
	
11187
			"/Completion/src/camelcase/FoFoFo.java",
10734
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11188
			"package camelcase;"+
10735
	String str = this.wc.getSource();
11189
			"public class FoFoFo {\n"+
10736
	String completeBehind = "extends CompletionInsideExtends";
11190
			"}");
10737
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11191
		
10738
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11192
		this.workingCopies[2] = getWorkingCopy(
10739
11193
			"/Completion/src/camelcase/FFFTest.java",
10740
	assertResults(
11194
			"package camelcase;"+
10741
			"CompletionInsideExtends2TopLevel[TYPE_REF]{CompletionInsideExtends2TopLevel, test, Ltest.CompletionInsideExtends2TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11195
			"public class FFFTest {\n"+
10742
			requestor.getResults());
10743
}
10744
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
10745
public void testCompletionInsideExtends3() throws JavaModelException {
10746
	this.wc = getWorkingCopy(
10747
			"/Completion/src/test/CompletionInsideExtends3.java",
10748
			"package test;\n" +
10749
			"public class CompletionInsideExtends3 {\n" +
10750
			"  public class CompletionInsideExtends3Inner extends {\n" +
10751
			"    public class CompletionInsideExtends3InnerInner {\n" +
10752
			"    }\n" +
10753
			"  }\n" +
10754
			"}\n" +
10755
			"class CompletionInsideExtends3TopLevel {\n" +
11196
			"}");
10756
			"}");
11197
	
10757
	
11198
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11199
		String str = this.workingCopies[0].getSource();
11200
		String completeBehind = "FF";
11201
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11202
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11203
	
10758
	
10759
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10760
	String str = this.wc.getSource();
10761
	String completeBehind = "extends ";
10762
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10763
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10764
10765
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11204
		assertResults(
10766
		assertResults(
11205
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" +
10767
				"",
11206
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10768
				requestor.getResults());
10769
	} else {
10770
		assertResults(
10771
				"CompletionInsideExtends3[TYPE_REF]{CompletionInsideExtends3, test, Ltest.CompletionInsideExtends3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10772
				"CompletionInsideExtends3TopLevel[TYPE_REF]{CompletionInsideExtends3TopLevel, test, Ltest.CompletionInsideExtends3TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11207
				requestor.getResults());
10773
				requestor.getResults());
11208
	} finally {
11209
		JavaCore.setOptions(oldOptions);
11210
	}
10774
	}
11211
}
10775
}
11212
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10776
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11213
public void testCamelCaseType3() throws JavaModelException {
10777
public void testCompletionInsideExtends4() throws JavaModelException {
11214
	this.oldOptions = JavaCore.getOptions();
10778
	this.wc = getWorkingCopy(
11215
	try {
10779
			"/Completion/src/test/CompletionInsideExtends4.java",
11216
		Hashtable options = new Hashtable(oldOptions);
10780
			"package test;\n" +
11217
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10781
			"public class CompletionInsideExtends4 {\n" +
11218
		JavaCore.setOptions(options);
10782
			"  public class CompletionInsideExtends4Inner extends CompletionInsideExtends{\n" +
11219
			
10783
			"    public class CompletionInsideExtends4InnerInner {\n" +
11220
		this.workingCopies = new ICompilationUnit[1];
10784
			"    }\n" +
11221
		this.workingCopies[0] = getWorkingCopy(
10785
			"  }\n" +
11222
			"/Completion/src/camelcase/Test.java",
10786
			"\n}" +
11223
			"package camelcase;"+
10787
			"class CompletionInsideExtends4TopLevel {\n" +
11224
			"public class Test {\n"+
10788
			"}");
11225
			"  /**/FF\n"+
10789
	
11226
			"}\n"+
10790
	
11227
			"class FoFoFo {\n"+
10791
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11228
			"}\n"+
10792
	String str = this.wc.getSource();
11229
			"class FFFTest {\n"+
10793
	String completeBehind = "extends CompletionInsideExtends";
10794
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10795
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10796
10797
	assertResults(
10798
			"CompletionInsideExtends4[TYPE_REF]{CompletionInsideExtends4, test, Ltest.CompletionInsideExtends4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10799
			"CompletionInsideExtends4TopLevel[TYPE_REF]{CompletionInsideExtends4TopLevel, test, Ltest.CompletionInsideExtends4TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10800
			requestor.getResults());
10801
}
10802
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
10803
public void testCompletionInsideExtends5() throws JavaModelException {
10804
	this.wc = getWorkingCopy(
10805
			"/Completion/src/test/CompletionInsideExtends5.java",
10806
			"package test;\n" +
10807
			"public class CompletionInsideExtends5 {\n" +
10808
			"  void foo() {\n" +
10809
			"    public class CompletionInsideExtends5Inner extends {\n" +
10810
			"      public class CompletionInsideExtends5InnerInner {\n" +
10811
			"      }\n" +
10812
			"    }\n" +
10813
			"  }\n" +
10814
			"}\n" +
10815
			"class CompletionInsideExtends5TopLevel {\n" +
11230
			"}");
10816
			"}");
11231
	
10817
	
11232
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11233
		String str = this.workingCopies[0].getSource();
11234
		String completeBehind = "/**/FF";
11235
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11236
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11237
	
10818
	
10819
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10820
	String str = this.wc.getSource();
10821
	String completeBehind = "extends ";
10822
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10823
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10824
10825
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11238
		assertResults(
10826
		assertResults(
11239
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10827
				"",
11240
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10828
				requestor.getResults());
11241
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10829
	} else {
10830
		assertResults(
10831
				"CompletionInsideExtends5[TYPE_REF]{CompletionInsideExtends5, test, Ltest.CompletionInsideExtends5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10832
				"CompletionInsideExtends5TopLevel[TYPE_REF]{CompletionInsideExtends5TopLevel, test, Ltest.CompletionInsideExtends5TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11242
				requestor.getResults());
10833
				requestor.getResults());
11243
	} finally {
11244
		JavaCore.setOptions(oldOptions);
11245
	}
10834
	}
11246
}
10835
}
11247
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10836
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11248
public void testCamelCaseType4() throws JavaModelException {
10837
public void testCompletionInsideExtends6() throws JavaModelException {
11249
	this.oldOptions = JavaCore.getOptions();
10838
	this.wc = getWorkingCopy(
11250
	try {
10839
			"/Completion/src/test/CompletionInsideExtends6.java",
11251
		Hashtable options = new Hashtable(oldOptions);
10840
			"package test;\n" +
11252
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10841
			"public class CompletionInsideExtends6 {\n" +
11253
		JavaCore.setOptions(options);
10842
			"  void foo() {\n" +
11254
		
10843
			"    public class CompletionInsideExtends6Inner extends CompletionInsideExtends {\n" +
11255
		this.workingCopies = new ICompilationUnit[3];
10844
			"      public class CompletionInsideExtends6InnerInner {\n" +
11256
		this.workingCopies[0] = getWorkingCopy(
10845
			"      }\n" +
11257
			"/Completion/src/camelcase/Test.java",
10846
			"    }\n" +
11258
			"package camelcase;"+
10847
			"  }\n" +
11259
			"public class Test {\n"+
10848
			"}\n" +
11260
			"  FF\n"+
10849
			"class CompletionInsideExtends6TopLevel {\n" +
11261
			"}");
10850
			"}");
11262
	
10851
	
11263
		this.workingCopies[1] = getWorkingCopy(
10852
	
11264
			"/Completion/src/camelcase/Member1.java",
10853
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11265
			"package camelcase;"+
10854
	String str = this.wc.getSource();
11266
			"public class Member1 {\n"+
10855
	String completeBehind = "extends CompletionInsideExtends";
11267
			"  public class FoFoFo {\n"+
10856
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11268
			"  }\n"+
10857
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11269
			"}");
10858
11270
		
10859
	assertResults(
11271
		this.workingCopies[2] = getWorkingCopy(
10860
			"CompletionInsideExtends6[TYPE_REF]{CompletionInsideExtends6, test, Ltest.CompletionInsideExtends6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11272
			"/Completion/src/camelcase/Member2.java",
10861
			"CompletionInsideExtends6TopLevel[TYPE_REF]{CompletionInsideExtends6TopLevel, test, Ltest.CompletionInsideExtends6TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11273
			"package camelcase;"+
10862
			requestor.getResults());
11274
			"public class Member2 {\n"+
10863
}
11275
			"  public class FFFTest {\n"+
10864
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11276
			"  }\n"+
10865
public void testCompletionInsideExtends7() throws JavaModelException {
10866
	this.wc = getWorkingCopy(
10867
			"/Completion/src/test/CompletionInsideExtends7.java",
10868
			"package test;\n" +
10869
			"public interface CompletionInsideExtends7 extends  {\n" +
10870
			"  public interface CompletionInsideExtends7Inner {}\n" +
10871
			"}\n" +
10872
			"interface CompletionInsideExtends7TopLevel {\n" +
11277
			"}");
10873
			"}");
11278
	
10874
	
11279
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11280
		String str = this.workingCopies[0].getSource();
11281
		String completeBehind = "FF";
11282
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11283
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11284
	
10875
	
10876
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10877
	String str = this.wc.getSource();
10878
	String completeBehind = "extends ";
10879
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10880
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10881
10882
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11285
		assertResults(
10883
		assertResults(
11286
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10884
				"",
11287
				"Member1.FoFoFo[TYPE_REF]{camelcase.Member1.FoFoFo, camelcase, Lcamelcase.Member1$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" +
10885
				requestor.getResults());
11288
				"Member2.FFFTest[TYPE_REF]{camelcase.Member2.FFFTest, camelcase, Lcamelcase.Member2$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
10886
	} else {
10887
		assertResults(
10888
				"CompletionInsideExtends7TopLevel[TYPE_REF]{CompletionInsideExtends7TopLevel, test, Ltest.CompletionInsideExtends7TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11289
				requestor.getResults());
10889
				requestor.getResults());
11290
	} finally {
11291
		JavaCore.setOptions(oldOptions);
11292
	}
10890
	}
11293
}
10891
}
11294
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10892
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11295
public void testCamelCaseType5() throws JavaModelException {
10893
public void testCompletionInsideExtends8() throws JavaModelException {
11296
	this.oldOptions = JavaCore.getOptions();
10894
	this.wc = getWorkingCopy(
11297
	try {
10895
			"/Completion/src/test/CompletionInsideExtends8.java",
11298
		Hashtable options = new Hashtable(oldOptions);
10896
			"package test;\n" +
11299
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10897
			"public interface CompletionInsideExtends8 extends CompletionInsideExtends {\n" +
11300
		JavaCore.setOptions(options);
10898
			"  public interface CompletionInsideExtends8Inner {}\n" +
11301
		
10899
			"}\n" +
11302
		this.workingCopies = new ICompilationUnit[1];
10900
			"interface CompletionInsideExtends8TopLevel {\n" +
11303
		this.workingCopies[0] = getWorkingCopy(
11304
			"/Completion/src/camelcase/Test.java",
11305
			"package camelcase;"+
11306
			"public class Test {\n"+
11307
			"  public class FoFoFo {\n"+
11308
			"    public class FFFTest {\n"+
11309
			"      FF\n"+
11310
			"    }\n"+
11311
			"  }\n"+
11312
			"}");
10901
			"}");
11313
	
10902
	
11314
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11315
		String str = this.workingCopies[0].getSource();
11316
		String completeBehind = "FF";
11317
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11318
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11319
	
10903
	
11320
		assertResults(
10904
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11321
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test$FoFoFo$FFFTest;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
10905
	String str = this.wc.getSource();
11322
				"Test.FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.Test$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10906
	String completeBehind = "extends CompletionInsideExtends";
11323
				"Test.FoFoFo.FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.Test$FoFoFo$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10907
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11324
				requestor.getResults());
10908
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11325
	} finally {
10909
11326
		JavaCore.setOptions(oldOptions);
10910
	assertResults(
11327
	}
10911
			"CompletionInsideExtends8TopLevel[TYPE_REF]{CompletionInsideExtends8TopLevel, test, Ltest.CompletionInsideExtends8TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10912
			requestor.getResults());
11328
}
10913
}
11329
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10914
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11330
public void testCamelCaseMethod1() throws JavaModelException {
10915
public void testCompletionInsideExtends9() throws JavaModelException {
11331
	this.oldOptions = JavaCore.getOptions();
10916
	this.wc = getWorkingCopy(
11332
	try {
10917
			"/Completion/src/test/CompletionInsideExtends9.java",
11333
		Hashtable options = new Hashtable(oldOptions);
10918
			"package test;\n" +
11334
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10919
			"public interface CompletionInsideExtends9 {\n" +
11335
		JavaCore.setOptions(options);
10920
			"  public interface CompletionInsideExtends9Inner extends {\n" +
11336
		
10921
			"    public interface CompletionInsideExtends9InnerInner {\n" +
11337
	this.workingCopies = new ICompilationUnit[1];
10922
			"    }\n" +
11338
		this.workingCopies[0] = getWorkingCopy(
10923
			"  }\n" +
11339
			"/Completion/src/camelcase/Test.java",
10924
			"}\n" +
11340
			"package camelcase;"+
10925
			"interface CompletionInsideExtends9TopLevel {\n" +
11341
			"public class Test {\n"+
11342
			"  void oneTwoThree(){}\n"+
11343
			"  void oTTMethod(){}\n"+
11344
			"  void foo() {\n"+
11345
			"    oTT\n"+
11346
			"  }\n"+
11347
			"}");
10926
			"}");
11348
	
10927
	
11349
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11350
		String str = this.workingCopies[0].getSource();
11351
		String completeBehind = "oTT";
11352
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11353
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11354
	
10928
	
10929
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10930
	String str = this.wc.getSource();
10931
	String completeBehind = "extends ";
10932
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10933
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10934
10935
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11355
		assertResults(
10936
		assertResults(
11356
				"oneTwoThree[METHOD_REF]{oneTwoThree(), Lcamelcase.Test;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10937
				"",
11357
				"oTTMethod[METHOD_REF]{oTTMethod(), Lcamelcase.Test;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10938
				requestor.getResults());
10939
	} else {
10940
		assertResults(
10941
				"CompletionInsideExtends9[TYPE_REF]{CompletionInsideExtends9, test, Ltest.CompletionInsideExtends9;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10942
				"CompletionInsideExtends9TopLevel[TYPE_REF]{CompletionInsideExtends9TopLevel, test, Ltest.CompletionInsideExtends9TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11358
				requestor.getResults());
10943
				requestor.getResults());
11359
	} finally {
11360
		JavaCore.setOptions(oldOptions);
11361
	}
10944
	}
11362
}
10945
}
11363
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10946
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11364
public void testCamelCaseField1() throws JavaModelException {
10947
public void testCompletionInsideExtends10() throws JavaModelException {
11365
	this.oldOptions = JavaCore.getOptions();
10948
	this.wc = getWorkingCopy(
11366
	try {
10949
			"/Completion/src/test/CompletionInsideExtends10.java",
11367
		Hashtable options = new Hashtable(oldOptions);
10950
			"package test;\n" +
11368
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10951
			"public interface CompletionInsideExtends10 {\n" +
11369
		JavaCore.setOptions(options);
10952
			"  public interface CompletionInsideExtends10Inner extends CompletionInsideExtends{\n" +
11370
		
10953
			"    public interface CompletionInsideExtends10InnerInner {\n" +
11371
		this.workingCopies = new ICompilationUnit[1];
10954
			"    }\n" +
11372
		this.workingCopies[0] = getWorkingCopy(
10955
			"  }\n" +
11373
			"/Completion/src/camelcase/Test.java",
10956
			"}\n" +
11374
			"package camelcase;"+
10957
			"interface CompletionInsideExtends10TopLevel {\n" +
11375
			"public class Test {\n"+
11376
			"  int oneTwoThree;\n"+
11377
			"  int oTTField;\n"+
11378
			"  void foo() {\n"+
11379
			"    oTT\n"+
11380
			"  }\n"+
11381
			"}");
10958
			"}");
11382
	
10959
	
11383
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11384
		String str = this.workingCopies[0].getSource();
11385
		String completeBehind = "oTT";
11386
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11387
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11388
	
10960
	
10961
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10962
	String str = this.wc.getSource();
10963
	String completeBehind = "extends CompletionInsideExtends";
10964
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10965
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10966
10967
	if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11389
		assertResults(
10968
		assertResults(
11390
				"oneTwoThree[FIELD_REF]{oneTwoThree, Lcamelcase.Test;, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10969
				"CompletionInsideExtends10.CompletionInsideExtends10Inner.CompletionInsideExtends10InnerInner[TYPE_REF]{test.CompletionInsideExtends10.CompletionInsideExtends10Inner.CompletionInsideExtends10InnerInner, test, Ltest.CompletionInsideExtends10$CompletionInsideExtends10Inner$CompletionInsideExtends10InnerInner;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_NON_RESTRICTED) + "}\n" +
11391
				"oTTField[FIELD_REF]{oTTField, Lcamelcase.Test;, I, oTTField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10970
				"CompletionInsideExtends10[TYPE_REF]{CompletionInsideExtends10, test, Ltest.CompletionInsideExtends10;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10971
				"CompletionInsideExtends10TopLevel[TYPE_REF]{CompletionInsideExtends10TopLevel, test, Ltest.CompletionInsideExtends10TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
10972
				requestor.getResults());
10973
	} else {
10974
		assertResults(
10975
				"CompletionInsideExtends10[TYPE_REF]{CompletionInsideExtends10, test, Ltest.CompletionInsideExtends10;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
10976
				"CompletionInsideExtends10TopLevel[TYPE_REF]{CompletionInsideExtends10TopLevel, test, Ltest.CompletionInsideExtends10TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11392
				requestor.getResults());
10977
				requestor.getResults());
11393
	} finally {
11394
		JavaCore.setOptions(oldOptions);
11395
	}
10978
	}
11396
}
10979
}
11397
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
10980
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11398
public void testCamelCaseLocalVariable1() throws JavaModelException {
10981
public void testCompletionInsideExtends11() throws JavaModelException {
11399
	this.oldOptions = JavaCore.getOptions();
10982
	this.wc = getWorkingCopy(
11400
	try {
10983
			"/Completion/src/test/CompletionInsideExtends11.java",
11401
		Hashtable options = new Hashtable(oldOptions);
10984
			"package test;\n" +
11402
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
10985
			"public class CompletionInsideExtends11 implements {\n" +
11403
		JavaCore.setOptions(options);
10986
			"  public class CompletionInsideExtends11Inner {\n" +
11404
		
10987
			"  }\n" +
11405
		this.workingCopies = new ICompilationUnit[1];
10988
			"}\n" +
11406
		this.workingCopies[0] = getWorkingCopy(
10989
			"class CompletionInsideExtends11TopLevel {\n" +
11407
			"/Completion/src/camelcase/Test.java",
11408
			"package camelcase;"+
11409
			"public class Test {\n"+
11410
			"  void foo() {\n"+
11411
			"    int oneTwoThree;\n"+
11412
			"    int oTTLocal;\n"+
11413
			"    oTT\n"+
11414
			"  }\n"+
11415
			"}");
10990
			"}");
11416
	
10991
	
11417
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11418
		String str = this.workingCopies[0].getSource();
11419
		String completeBehind = "oTT";
11420
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11421
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11422
	
10992
	
10993
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10994
	String str = this.wc.getSource();
10995
	String completeBehind = "implements ";
10996
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10997
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
10998
10999
	if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11423
		assertResults(
11000
		assertResults(
11424
				"oneTwoThree[LOCAL_VARIABLE_REF]{oneTwoThree, null, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11001
				"",
11425
				"oTTLocal[LOCAL_VARIABLE_REF]{oTTLocal, null, I, oTTLocal, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11002
				requestor.getResults());
11003
	} else if (CompletionEngine.PROPOSE_MEMBER_TYPES) {
11004
		assertResults(
11005
				"",
11006
				requestor.getResults());
11007
	} else {
11008
		assertResults(
11009
				"CompletionInsideExtends11TopLevel[TYPE_REF]{CompletionInsideExtends11TopLevel, test, Ltest.CompletionInsideExtends11TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11426
				requestor.getResults());
11010
				requestor.getResults());
11427
	} finally {
11428
		JavaCore.setOptions(oldOptions);
11429
	}
11011
	}
11430
}
11012
}
11431
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
11013
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78151
11432
public void testCamelCaseMethodDeclaration1() throws JavaModelException {
11014
public void testCompletionInsideExtends12() throws JavaModelException {
11433
	this.oldOptions = JavaCore.getOptions();
11015
	this.wc = getWorkingCopy(
11434
	try {
11016
			"/Completion/src/test/CompletionInsideExtends12.java",
11435
		Hashtable options = new Hashtable(oldOptions);
11017
			"package test;\n" +
11436
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
11018
			"public class CompletionInsideExtends12 implements CompletionInsideExtends {\n" +
11437
		JavaCore.setOptions(options);
11019
			"  public class CompletionInsideExtends12Inner {\n" +
11438
		
11020
			"  }\n" +
11439
		this.workingCopies = new ICompilationUnit[2];
11021
			"}\n" +
11440
		this.workingCopies[0] = getWorkingCopy(
11022
			"class CompletionInsideExtends12TopLevel {\n" +
11441
			"/Completion/src/camelcase/Test.java",
11442
			"package camelcase;"+
11443
			"public class Test extends SuperClass {\n"+
11444
			"  oTT\n"+
11445
			"}");
11446
		
11447
		this.workingCopies[1] = getWorkingCopy(
11448
			"/Completion/src/camelcase/SuperClass.java",
11449
			"package camelcase;"+
11450
			"public class SuperClass {\n"+
11451
			"  public void oneTwoThree(){}\n"+
11452
			"  public void oTTMethod(){}\n"+
11453
			"}");
11023
			"}");
11454
	
11024
	
11455
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11456
		String str = this.workingCopies[0].getSource();
11457
		String completeBehind = "oTT";
11458
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11459
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11460
	
11025
	
11461
		assertResults(
11462
				"oTT[POTENTIAL_METHOD_DECLARATION]{oTT, Lcamelcase.Test;, ()V, oTT, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11463
				"oneTwoThree[METHOD_DECLARATION]{public void oneTwoThree(), Lcamelcase.SuperClass;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11464
				"oTTMethod[METHOD_DECLARATION]{public void oTTMethod(), Lcamelcase.SuperClass;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11465
				requestor.getResults());
11466
	} finally {
11467
		JavaCore.setOptions(oldOptions);
11468
	}
11469
}
11470
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11471
public void testLabel1() throws JavaModelException {
11472
	this.workingCopies = new ICompilationUnit[1];
11473
	this.workingCopies[0] = getWorkingCopy(
11474
		"/Completion/src/label/Test.java",
11475
		"package label;"+
11476
		"public class Test {\n"+
11477
		"  void foo() {\n"+
11478
		"    label1 : for(;;) foo();\n"+
11479
		"    label2 : for(;;)\n"+
11480
		"      label3 : for(;;) {\n"+
11481
		"        label4 : for(;;) {\n"+
11482
		"          break lab\n"+
11483
		"        }\n"+
11484
		"      }\n"+
11485
		"  }\n"+
11486
		"}");
11487
11488
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11489
	String str = this.workingCopies[0].getSource();
11490
	String completeBehind = "lab";
11491
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11492
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11493
11494
	assertResults(
11495
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11496
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11497
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11498
			requestor.getResults());
11499
}
11500
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11501
public void testLabel2() throws JavaModelException {
11502
	this.workingCopies = new ICompilationUnit[1];
11503
	this.workingCopies[0] = getWorkingCopy(
11504
		"/Completion/src/label/Test.java",
11505
		"package label;"+
11506
		"public class Test {\n"+
11507
		"  void foo() {\n"+
11508
		"    #\n"+
11509
		"    label1 : for(;;) foo();\n"+
11510
		"    label2 : for(;;)\n"+
11511
		"      label3 : for(;;) {\n"+
11512
		"        label4 : for(;;) {\n"+
11513
		"          break lab\n"+
11514
		"        }\n"+
11515
		"      }\n"+
11516
		"  }\n"+
11517
		"}");
11518
11519
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11520
	String str = this.workingCopies[0].getSource();
11521
	String completeBehind = "lab";
11522
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11523
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11524
11525
	assertResults(
11526
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11527
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11528
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11529
			requestor.getResults());
11530
}
11531
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11532
public void testLabel3() throws JavaModelException {
11533
	this.workingCopies = new ICompilationUnit[1];
11534
	this.workingCopies[0] = getWorkingCopy(
11535
		"/Completion/src/label/Test.java",
11536
		"package label;"+
11537
		"public class Test {\n"+
11538
		"  void foo() {\n"+
11539
		"    label1 : for(;;) foo();\n"+
11540
		"    label2 : for(;;)\n"+
11541
		"      label3 : for(;;) {\n"+
11542
		"        label4 : for(;;) {\n"+
11543
		"          break lab\n"+
11544
		"  }\n"+
11545
		"}");
11546
11547
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11026
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11548
	String str = this.workingCopies[0].getSource();
11027
	String str = this.wc.getSource();
11549
	String completeBehind = "lab";
11028
	String completeBehind = "implements CompletionInsideExtends";
11550
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11029
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11551
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11030
	this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11552
11031
11553
	assertResults(
11032
	if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11554
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11033
		assertResults(
11555
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11034
				"",
11556
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11035
				requestor.getResults());
11557
			requestor.getResults());
11036
	} else {
11037
		assertResults(
11038
				"CompletionInsideExtends12TopLevel[TYPE_REF]{CompletionInsideExtends12TopLevel, test, Ltest.CompletionInsideExtends12TopLevel;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11039
				requestor.getResults());
11040
	}
11558
}
11041
}
11559
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11042
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690
11560
public void testLabel4() throws JavaModelException {
11043
public void testCompletionArrayLength() throws JavaModelException {
11561
	this.workingCopies = new ICompilationUnit[1];
11044
    this.wc = getWorkingCopy(
11562
	this.workingCopies[0] = getWorkingCopy(
11045
            "/Completion/src/test/CompletionArrayLength.java",
11563
		"/Completion/src/label/Test.java",
11046
            "package test;\n" +
11564
		"package label;"+
11047
            "public class CompletionArrayLength {\n" +
11565
		"public class Test {\n"+
11048
            "  public void foo() {\n" +
11566
		"  void foo() {\n"+
11049
            "    long[] var;\n" +
11567
		"    #\n"+
11050
            "    var.leng\n" +
11568
		"    label1 : for(;;) foo();\n"+
11051
            "  }" +
11569
		"    label2 : for(;;)\n"+
11052
            "}");
11570
		"      label3 : for(;;) {\n"+
11053
    
11571
		"        label4 : for(;;) {\n"+
11054
    
11572
		"          break lab\n"+
11055
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11573
		"  }\n"+
11056
    String str = this.wc.getSource();
11574
		"}");
11057
    String completeBehind = "leng";
11575
11058
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11576
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11059
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11577
	String str = this.workingCopies[0].getSource();
11578
	String completeBehind = "lab";
11579
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11580
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11581
11060
11582
	assertResults(
11061
    assertResults(
11583
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11062
            "length[FIELD_REF]{length, [J, I, length, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11584
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11063
            requestor.getResults());
11585
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11586
			requestor.getResults());
11587
}
11064
}
11588
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11065
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690
11589
public void testLabel5() throws JavaModelException {
11066
public void testCompletionArrayClone() throws JavaModelException {
11590
	this.workingCopies = new ICompilationUnit[1];
11067
    this.wc = getWorkingCopy(
11591
	this.workingCopies[0] = getWorkingCopy(
11068
            "/Completion/src/test/CompletionArrayClone.java",
11592
		"/Completion/src/label/Test.java",
11069
            "package test;\n" +
11593
		"package label;"+
11070
            "public class CompletionArrayClone {\n" +
11594
		"public class Test {\n" + 
11071
            "  public void foo() {\n" +
11595
		"  void foo() {\n" + 
11072
            "    long[] var;\n" +
11596
		"    #\n" + 
11073
            "    var.clon\n" +
11597
 		"    label1 : for(;;) {\n" + 
11074
            "  }\n" +
11598
 		"      class X {\n" + 
11075
            "}");
11599
 		"        void foo() {\n" + 
11076
    
11600
 		"          label2 : for(;;) foo();\n" + 
11077
    
11601
 		"        }\n" + 
11078
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11602
 		"      }\n" + 
11079
    String str = this.wc.getSource();
11603
 		"      continue lab\n" + 
11080
    String completeBehind = "clon";
11604
 		"    }\n" + 
11081
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11605
		"  }\n" + 
11082
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11606
		"}\n");
11607
11083
11608
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11084
    assertResults(
11609
	String str = this.workingCopies[0].getSource();
11085
            "clone[METHOD_REF]{clone(), [J, ()Ljava.lang.Object;, clone, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
11610
	String completeBehind = "lab";
11086
            requestor.getResults());
11611
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11087
}
11612
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11088
public void testCompletionAllMemberTypes() throws JavaModelException {
11089
    this.wc = getWorkingCopy(
11090
            "/Completion/src/test/CompletionAllMemberTypes.java",
11091
            "package test;\n" +
11092
            "public class CompletionAllMemberTypes {\n" +
11093
            "  class Member1 {\n" +
11094
            "    class Member2 {\n" +
11095
            "      class Member3 {\n" +
11096
            "      }\n" +
11097
            "    }\n" +
11098
            "    void foo(){\n" +
11099
            "      Member\n" +
11100
            "    }\n" +
11101
            "  \n}" +
11102
            "}");
11103
    
11104
    
11105
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11106
    String str = this.wc.getSource();
11107
    String completeBehind = "Member";
11108
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11109
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11613
11110
11614
	assertResults(
11111
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11615
			"label1[LABEL_REF]{label1, null, null, label1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11112
    	assertResults(
11616
			requestor.getResults());
11113
	            "CompletionAllMemberTypes.Member1.Member2.Member3[TYPE_REF]{test.CompletionAllMemberTypes.Member1.Member2.Member3, test, Ltest.CompletionAllMemberTypes$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11114
				"CompletionAllMemberTypes.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11115
				"CompletionAllMemberTypes.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11116
	            requestor.getResults());
11117
    } else {
11118
    	assertResults(
11119
	            "CompletionAllMemberTypes.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11120
				"CompletionAllMemberTypes.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11121
	            requestor.getResults());
11122
    }
11617
}
11123
}
11618
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
11124
public void testCompletionAllMemberTypes2() throws JavaModelException {
11619
public void testLabel6() throws JavaModelException {
11125
    this.wc = getWorkingCopy(
11620
	this.workingCopies = new ICompilationUnit[1];
11126
            "/Completion/src/test/CompletionAllMemberTypes2.java",
11621
	this.workingCopies[0] = getWorkingCopy(
11127
            "package test;\n" +
11622
		"/Completion/src/label/Test.java",
11128
            "public class CompletionAllMemberTypes2 {\n" +
11623
		"package label;"+
11129
            "  class Member1 {\n" +
11624
		"public class Test {\n" + 
11130
            "    class Member5 {\n" +
11625
		"  void foo() {\n" + 
11131
            "      class Member6 {\n" +
11626
		"    #\n" + 
11132
            "      }\n" +
11627
 		"    label1 : for(;;) {\n" + 
11133
            "    }\n" +
11628
 		"      class X {\n" + 
11134
            "    class Member2 {\n" +
11629
 		"        void foo() {\n" + 
11135
            "      class Member3 {\n" +
11630
 		"          label2 : for(;;) {\n" + 
11136
            "        class Member4 {\n" +
11631
 		"            continue lab\n" + 
11137
            "        }\n" +
11632
 		"          }\n" + 
11138
            "      }\n" +
11633
 		"        }\n" + 
11139
            "      void foo(){\n" +
11634
 		"      }\n" + 
11140
            "        Member\n" +
11635
 		"    }\n" + 
11141
            "      }\n" +
11636
		"  }\n" + 
11142
            "    }\n" +
11637
		"}\n");
11143
            "  \n}" +
11144
            "}");
11145
    
11146
    
11147
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11148
    String str = this.wc.getSource();
11149
    String completeBehind = "Member";
11150
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11151
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11638
11152
11639
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11153
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11640
	String str = this.workingCopies[0].getSource();
11154
    	assertResults(
11641
	String completeBehind = "lab";
11155
	            "CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11642
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11156
				"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11643
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11157
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11158
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11159
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11160
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11161
	            requestor.getResults());
11162
    } else {
11163
    	assertResults(
11164
	            "CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11165
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11166
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11167
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11168
	            requestor.getResults());
11169
    }
11170
}
11171
public void testCompletionAllMemberTypes3() throws JavaModelException {
11172
    this.wc = getWorkingCopy(
11173
            "/Completion/src/test/CompletionAllMemberTypes2.java",
11174
            "package test;\n" +
11175
            "public interface CompletionAllMemberTypes2 {\n" +
11176
            "  interface Member1 {\n" +
11177
            "    interface Member5 {\n" +
11178
            "      interface Member6 {\n" +
11179
            "      }\n" +
11180
            "    }\n" +
11181
            "    interface Member2 {\n" +
11182
            "      interface Member3 {\n" +
11183
            "        interface Member4 {\n" +
11184
            "        }\n" +
11185
            "      }\n" +
11186
            "        Member\n" +
11187
            "    }\n" +
11188
            "  \n}" +
11189
            "}");
11190
    
11191
    
11192
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11193
    String str = this.wc.getSource();
11194
    String completeBehind = "Member";
11195
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11196
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11644
11197
11645
	assertResults(
11198
    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11646
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11199
    	assertResults(
11647
			requestor.getResults());
11200
	            "Member[POTENTIAL_METHOD_DECLARATION]{Member, Ltest.CompletionAllMemberTypes2$Member1$Member2;, ()V, Member, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11201
				"CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11202
				"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11203
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11204
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11205
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11206
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11207
	            requestor.getResults());
11208
    } else {
11209
    	assertResults(
11210
	            "Member[POTENTIAL_METHOD_DECLARATION]{Member, Ltest.CompletionAllMemberTypes2$Member1$Member2;, ()V, Member, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11211
				"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11212
				"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11213
				"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11214
				"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11215
	            requestor.getResults());
11216
    }
11648
}
11217
}
11649
public void testParameterNames1() throws CoreException, IOException {
11218
public void testCompletionAllMemberTypes4() throws JavaModelException {
11650
	Map options = COMPLETION_PROJECT.getOptions(true);
11219
	ICompilationUnit anInterface = null;
11651
	Object timeout = options.get(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC);
11652
	try {
11220
	try {
11653
		options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000");
11221
		anInterface = getWorkingCopy(
11654
		COMPLETION_PROJECT.setOptions(options);
11222
	            "/Completion/src/test/AnInterface.java",
11655
		this.workingCopies = new ICompilationUnit[1];
11223
	            "package test;\n" +
11656
		this.workingCopies[0] = getWorkingCopy(
11224
	            "public interface AnInterface {\n" +
11657
			"/Completion/src/p/Test.java",
11225
	            "  public interface Member1 {\n" +
11658
			"package p;"+
11226
	            "    public interface Member5 {\n" +
11659
			"public class Test {\n" + 
11227
	            "      public interface Member6 {\n" +
11660
			"  void foo(doctest.X x) {\n" + 
11228
	            "      }\n" +
11661
			"    x.fo\n" + 
11229
	            "    }\n" +
11662
			"  }\n" + 
11230
	            "    public interface Member2 {\n" +
11663
			"}\n");
11231
	            "      public interface Member3 {\n" +
11232
	            "        interface Member4 {\n" +
11233
	            "        }\n" +
11234
	            "      }\n" +
11235
	            "        Member\n" +
11236
	            "    }\n" +
11237
	            "  \n}" +
11238
	            "}");
11664
		
11239
		
11665
		addLibrary(
11240
	    this.wc = getWorkingCopy(
11666
				"Completion", 
11241
	            "/Completion/src/test/CompletionAllMemberTypes2.java",
11667
				"tmpDoc.jar",
11242
	            "package test;\n" +
11668
				null,
11243
	            "public class CompletionAllMemberTypes2 {\n" +
11669
				"tmpDocDoc.zip",
11244
	            "  class Member1 {\n" +
11670
				false);
11245
	            "    class Member5 {\n" +
11246
	            "      class Member6 {\n" +
11247
	            "      }\n" +
11248
	            "    }\n" +
11249
	            "    class Member2 implements AnInterface {\n" +
11250
	            "      class Member3 {\n" +
11251
	            "        class Member4 {\n" +
11252
	            "        }\n" +
11253
	            "      }\n" +
11254
	            "      void foo(){\n" +
11255
	            "        Member\n" +
11256
	            "      }\n" +
11257
	            "    }\n" +
11258
	            "  \n}" +
11259
	            "}");
11260
	    
11261
	    
11262
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11263
	    String str = this.wc.getSource();
11264
	    String completeBehind = "Member";
11265
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11266
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11267
	
11268
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11269
	    	assertResults(
11270
		            "AnInterface.Member1.Member2[TYPE_REF]{test.AnInterface.Member1.Member2, test, Ltest.AnInterface$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11271
					"AnInterface.Member1.Member2.Member3[TYPE_REF]{test.AnInterface.Member1.Member2.Member3, test, Ltest.AnInterface$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11272
					"AnInterface.Member1.Member2.Member3.Member4[TYPE_REF]{test.AnInterface.Member1.Member2.Member3.Member4, test, Ltest.AnInterface$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11273
					"AnInterface.Member1.Member5[TYPE_REF]{test.AnInterface.Member1.Member5, test, Ltest.AnInterface$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11274
					"AnInterface.Member1.Member5.Member6[TYPE_REF]{test.AnInterface.Member1.Member5.Member6, test, Ltest.AnInterface$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11275
					"CompletionAllMemberTypes2.Member1.Member2.Member3.Member4[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member2.Member3.Member4, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11276
					"CompletionAllMemberTypes2.Member1.Member5.Member6[TYPE_REF]{test.CompletionAllMemberTypes2.Member1.Member5.Member6, test, Ltest.CompletionAllMemberTypes2$Member1$Member5$Member6;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11277
					"AnInterface.Member1[TYPE_REF]{Member1, test, Ltest.AnInterface$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11278
					"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11279
					"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11280
					"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11281
					"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11282
		            requestor.getResults());
11283
	    } else {
11284
	    	assertResults(
11285
		            "AnInterface.Member1[TYPE_REF]{Member1, test, Ltest.AnInterface$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11286
					"CompletionAllMemberTypes2.Member1[TYPE_REF]{Member1, test, Ltest.CompletionAllMemberTypes2$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11287
					"CompletionAllMemberTypes2.Member1.Member2[TYPE_REF]{Member2, test, Ltest.CompletionAllMemberTypes2$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11288
					"CompletionAllMemberTypes2.Member1.Member2.Member3[TYPE_REF]{Member3, test, Ltest.CompletionAllMemberTypes2$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11289
					"CompletionAllMemberTypes2.Member1.Member5[TYPE_REF]{Member5, test, Ltest.CompletionAllMemberTypes2$Member1$Member5;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11290
		            requestor.getResults());
11291
	    }
11292
	} finally {
11293
		if(anInterface != null) {
11294
			anInterface.discardWorkingCopy();
11295
		}
11296
	}
11297
}
11298
public void testCompletionAllMemberTypes5() throws JavaModelException {
11299
	ICompilationUnit aType = null;
11300
	Hashtable oldCurrentOptions = JavaCore.getOptions();
11301
	try {
11302
		Hashtable options = new Hashtable(oldCurrentOptions);
11303
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
11304
		JavaCore.setOptions(options);
11671
		
11305
		
11672
		CompletionTestsRequestor2 requestor;
11306
		aType = getWorkingCopy(
11673
		try {
11307
	            "/Completion/src/test/AType.java",
11674
			requestor = new CompletionTestsRequestor2(true);
11308
	            "package test;\n" +
11675
			String str = this.workingCopies[0].getSource();
11309
	            "public class AType {\n" +
11676
			String completeBehind = "x.fo";
11310
	            "  public class Member1 {\n" +
11677
			int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11311
	            "    private class Member2 {\n" +
11678
			this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11312
	            "      public class Member3 {\n" +
11679
			
11313
	            "        public class Member4 {\n" +
11680
			assertResults(
11314
	            "        }\n" +
11681
				"foo[METHOD_REF]{foo(), Ldoctest.X;, (Ljava.lang.Object;)V, foo, (param), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
11315
	            "      }\n" +
11682
				requestor.getResults());
11316
	            "    }\n" +
11683
		} finally {
11317
	            "  \n}" +
11684
			removeLibrary("Completion", "tmpDoc.jar");
11318
	            "}");
11319
		
11320
	    this.wc = getWorkingCopy(
11321
	            "/Completion/src/test/CompletionAllMemberTypes5.java",
11322
	            "package test;\n" +
11323
	            "public class CompletionAllMemberTypes5 {\n" +
11324
	            "  void foo(){\n" +
11325
	            "    Member\n" +
11326
	            "  }\n" +
11327
	            "}");
11328
	    
11329
	    
11330
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11331
	    String str = this.wc.getSource();
11332
	    String completeBehind = "Member";
11333
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11334
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11335
	
11336
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11337
	    	// AType.Member1.Member2.Member3 and AType.Member1.Member2.Member3.Member4 should not be proposed because they are not visible.
11338
	    	// But visibility need modifiers of enclosing types to be computed. 
11339
	    	assertResults(
11340
		            "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11341
					"AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11342
					"AType.Member1.Member2.Member3.Member4[TYPE_REF]{test.AType.Member1.Member2.Member3.Member4, test, Ltest.AType$Member1$Member2$Member3$Member4;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11343
		            requestor.getResults());
11344
	    } else {
11345
	    	assertResults(
11346
		            "",
11347
		            requestor.getResults());
11348
	    }
11349
	} finally {
11350
		if(aType != null) {
11351
			aType.discardWorkingCopy();
11685
		}
11352
		}
11353
		JavaCore.setOptions(oldCurrentOptions);
11354
	}
11355
}
11356
public void testCompletionAllMemberTypes6() throws JavaModelException {
11357
	Hashtable oldCurrentOptions = JavaCore.getOptions();
11358
	try {
11359
		Hashtable options = new Hashtable(oldCurrentOptions);
11360
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
11361
		JavaCore.setOptions(options);
11362
		
11363
	    this.wc = getWorkingCopy(
11364
	            "/Completion/src/test/CompletionAllMemberTypes6.java",
11365
	            "package test;\n" +
11366
	            "class AType {\n" +
11367
	            "  public class Member1 {\n" +
11368
	            "    private class Member2 {\n" +
11369
	            "      public class Member3 {\n" +
11370
	            "      }\n" +
11371
	            "    }\n" +
11372
	            "  }\n" +
11373
	            "}\n" +
11374
	            "public class CompletionAllMemberTypes6 {\n" +
11375
	            "  void foo(){\n" +
11376
	            "    Member\n" +
11377
	            "  }\n" +
11378
	            "}");
11379
	    
11380
	    
11381
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11382
	    String str = this.wc.getSource();
11383
	    String completeBehind = "Member";
11384
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11385
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11386
	
11387
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11388
	    	assertResults(
11389
		            "AType.Member1[TYPE_REF]{test.AType.Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11390
		            requestor.getResults());
11391
	    } else {
11392
	    	assertResults(
11393
		            "",
11394
		            requestor.getResults());
11395
	    }
11396
	} finally {
11397
		JavaCore.setOptions(oldCurrentOptions);
11398
	}
11399
}
11400
public void testCompletionAllMemberTypes7() throws JavaModelException {
11401
	Hashtable oldCurrentOptions = JavaCore.getOptions();
11402
	try {
11403
		Hashtable options = new Hashtable(oldCurrentOptions);
11404
		options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
11405
		JavaCore.setOptions(options);
11406
		
11407
	    this.wc = getWorkingCopy(
11408
	            "/Completion/src/test/AType.java",
11409
	            "package test;\n" +
11410
	            "class AType {\n" +
11411
	            "  public class Member1 {\n" +
11412
	            "    private class Member2 {\n" +
11413
	            "      public class Member3 {\n" +
11414
	            "      }\n" +
11415
	            "    }\n" +
11416
	            "  }\n" +
11417
	            "  void foo(){\n" +
11418
	            "    Member\n" +
11419
	            "  }\n" +
11420
	            "}");
11421
	    
11422
	    
11423
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11424
	    String str = this.wc.getSource();
11425
	    String completeBehind = "Member";
11426
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11427
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11428
	
11429
	    if(CompletionEngine.PROPOSE_MEMBER_TYPES) {
11430
	    	assertResults(
11431
		            "AType.Member1.Member2[TYPE_REF]{test.AType.Member1.Member2, test, Ltest.AType$Member1$Member2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11432
					"AType.Member1.Member2.Member3[TYPE_REF]{test.AType.Member1.Member2.Member3, test, Ltest.AType$Member1$Member2$Member3;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11433
					"AType.Member1[TYPE_REF]{Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11434
		            requestor.getResults());
11435
	    } else {
11436
	    	assertResults(
11437
		            "AType.Member1[TYPE_REF]{Member1, test, Ltest.AType$Member1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11438
		            requestor.getResults());
11439
	    }
11686
	} finally {
11440
	} finally {
11687
		options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, timeout);
11441
		JavaCore.setOptions(oldCurrentOptions);
11688
		COMPLETION_PROJECT.setOptions(options);
11689
	}
11442
	}
11690
}
11443
}
11691
public void testInconsistentHierarchy1() throws CoreException, IOException {
11444
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=96213
11692
	this.workingCopies = new ICompilationUnit[1];
11445
public void testBug96213() throws JavaModelException {
11693
	this.workingCopies[0] = getWorkingCopy(
11446
    this.wc = getWorkingCopy(
11694
		"/Completion/src/p/Test.java",
11447
            "/Completion/src/test/Test.java",
11695
		"package p;"+
11448
            "package test;\n" +
11696
		"public class Test extends Unknown {\n" + 
11449
            "public class Test{\n"+
11697
		"  void foo() {\n" + 
11450
            "  Test toto(Object o) {\n"+
11698
		"    this.has\n" + 
11451
            "    return null;\n"+
11699
		"  }\n" + 
11452
            "  }\n"+
11700
		"}\n");
11453
            "  void titi(int removed) {\n"+
11701
	
11454
            "  }\n"+
11702
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11455
            "  void foo() {\n"+
11703
	String str = this.workingCopies[0].getSource();
11456
            "    int removed = 0;\n"+
11704
	String completeBehind = "this.has";
11457
            "    toto(Test.this).titi(removed);\n"+
11705
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11458
            "  }\n"+
11706
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11459
            "}");
11707
	
11460
    
11461
    
11462
    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11463
    String str = this.wc.getSource();
11464
    String completeBehind = "removed";
11465
    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11466
    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11467
11708
	assertResults(
11468
	assertResults(
11709
		"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, hashCode, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
11469
            "removed[LOCAL_VARIABLE_REF]{removed, null, I, removed, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11710
		requestor.getResults());
11470
            requestor.getResults());
11711
}
11471
}
11712
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11472
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95167
11713
public void testDeprecationCheck1() throws JavaModelException {
11473
public void testCompletionWithProblem1() throws JavaModelException {
11714
	Map options = COMPLETION_PROJECT.getOptions(true);
11474
	ICompilationUnit aType = null;
11715
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11716
	try {
11475
	try {
11717
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
11476
		aType = getWorkingCopy(
11718
		COMPLETION_PROJECT.setOptions(options);
11477
	            "/Completion/src/test/AType.java",
11719
		
11478
	            "package test;\n" +
11720
		this.workingCopies = new ICompilationUnit[3];
11479
	            "public class AType{\n"+
11721
		this.workingCopies[0] = getWorkingCopy(
11480
	            "  void foo(Unknown var) {\n"+
11722
			"/Completion/src/deprecation/Test.java",
11481
	            "  }\n"+
11723
			"package deprecation;"+
11482
	            "}");
11724
			"public class Test {\n"+
11725
			"  ZZZTy\n"+
11726
			"}");
11727
		
11728
		this.workingCopies[1] = getWorkingCopy(
11729
			"/Completion/src/deprecation/ZZZType1.java",
11730
			"package deprecation;"+
11731
			"public class ZZZType1 {\n"+
11732
			"}");
11733
		
11483
		
11734
		this.workingCopies[2] = getWorkingCopy(
11484
	    this.wc = getWorkingCopy(
11735
			"/Completion/src/deprecation/ZZZType2.java",
11485
	            "/Completion/src/test/Test.java",
11736
			"package deprecation;"+
11486
	            "package test;\n" +
11737
			"/** @deprecated */\n"+
11487
	            "public class Test{\n"+
11738
			"public class ZZZType2 {\n"+
11488
	            "  void foo() {\n"+
11739
			"}");
11489
	            "    AType a = null;\n"+
11740
	
11490
	            "    a.zz\n"+
11741
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11491
	            "  }\n"+
11742
		String str = this.workingCopies[0].getSource();
11492
	            "}");
11743
		String completeBehind = "ZZZTy";
11493
	    
11744
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11494
	    
11745
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11495
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11496
	    String str = this.wc.getSource();
11497
	    String completeBehind = "a.zz";
11498
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11499
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11746
	
11500
	
11501
	    // no completion must be found
11747
		assertResults(
11502
		assertResults(
11748
				"ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11503
	            "",
11749
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11504
	            requestor.getResults());
11750
				"ZZZType2[TYPE_REF]{ZZZType2, deprecation, Ldeprecation.ZZZType2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11505
		
11751
				requestor.getResults());
11506
		// no error must be found
11507
		assertResults(
11508
	            "",
11509
	            requestor.getProblem());
11752
	} finally {
11510
	} finally {
11753
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11511
		if(aType != null) {
11754
		COMPLETION_PROJECT.setOptions(options);
11512
			aType.discardWorkingCopy();
11513
		}
11755
	}
11514
	}
11756
}
11515
}
11757
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11516
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
11758
public void testDeprecationCheck2() throws JavaModelException {
11517
public void testCompletionExpectedTypeOnEmptyToken1() throws JavaModelException {
11759
	Map options = COMPLETION_PROJECT.getOptions(true);
11518
	ICompilationUnit aType = null;
11760
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11761
	try {
11519
	try {
11762
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11763
		COMPLETION_PROJECT.setOptions(options);
11764
		
11765
		this.workingCopies = new ICompilationUnit[3];
11766
		this.workingCopies[0] = getWorkingCopy(
11767
			"/Completion/src/deprecation/Test.java",
11768
			"package deprecation;"+
11769
			"public class Test {\n"+
11770
			"  ZZZTy\n"+
11771
			"}");
11772
		
11520
		
11773
		this.workingCopies[1] = getWorkingCopy(
11521
		aType = getWorkingCopy(
11774
			"/Completion/src/deprecation/ZZZType1.java",
11522
	            "/Completion/src/test/AType.java",
11775
			"package deprecation;"+
11523
	            "package test;\n" +
11776
			"public class ZZZType1 {\n"+
11524
	            "public class AType{\n"+
11777
			"}");
11525
	            "}");
11778
		
11526
		
11779
		this.workingCopies[2] = getWorkingCopy(
11527
	    this.wc = getWorkingCopy(
11780
			"/Completion/src/deprecation/ZZZType2.java",
11528
	            "/Completion/src/test/Test.java",
11781
			"package deprecation;"+
11529
	            "package test;\n" +
11782
			"/** @deprecated */\n"+
11530
	            "public class Test{\n"+
11783
			"public class ZZZType2 {\n"+
11531
	            "  void foo() {\n"+
11784
			"}");
11532
	            "    AType a = new \n"+
11785
	
11533
	            "  }\n"+
11786
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11534
	            "}");
11787
		String str = this.workingCopies[0].getSource();
11535
	    
11788
		String completeBehind = "ZZZTy";
11536
	    
11789
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11537
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11790
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11538
	    String str = this.wc.getSource();
11539
	    String completeBehind = "AType a = new ";
11540
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11541
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11791
	
11542
	
11792
		assertResults(
11543
	    assertResults(
11793
				"ZZZTy[POTENTIAL_METHOD_DECLARATION]{ZZZTy, Ldeprecation.Test;, ()V, ZZZTy, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11544
	            "expectedTypesSignatures={Ltest.AType;}\n"+
11794
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11545
	            "expectedTypesKeys={Ltest/AType;}",
11795
				requestor.getResults());
11546
	            requestor.getContext());
11547
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11548
			assertResults(
11549
		            "AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11550
		            requestor.getResults());
11551
	    } else {
11552
	    	assertResults(
11553
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11554
					"AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11555
		            requestor.getResults());
11556
	    }
11796
	} finally {
11557
	} finally {
11797
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11558
		if(aType != null) {
11798
		COMPLETION_PROJECT.setOptions(options);
11559
			aType.discardWorkingCopy();
11560
		}
11799
	}
11561
	}
11800
}
11562
}
11801
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11563
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
11802
public void testDeprecationCheck3() throws JavaModelException {
11564
public void testCompletionExpectedTypeOnEmptyToken3() throws JavaModelException {
11803
	Map options = COMPLETION_PROJECT.getOptions(true);
11565
	ICompilationUnit aType = null;
11804
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11805
	try {
11566
	try {
11806
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
11567
		aType = getWorkingCopy(
11807
		COMPLETION_PROJECT.setOptions(options);
11568
	            "/Completion/src/test/AType.java",
11808
		
11569
	            "package test;\n" +
11809
		this.workingCopies = new ICompilationUnit[2];
11570
	            "public class AType{\n"+
11810
		this.workingCopies[0] = getWorkingCopy(
11571
	            "}");
11811
			"/Completion/src/deprecation/Test.java",
11812
			"package deprecation;"+
11813
			"public class Test {\n"+
11814
			"  void foo() {"+
11815
			"    ZZZType1.fo\n"+
11816
			"  }"+
11817
			"}");
11818
		
11572
		
11819
		this.workingCopies[1] = getWorkingCopy(
11573
	    this.wc = getWorkingCopy(
11820
			"/Completion/src/deprecation/ZZZType1.java",
11574
	            "/Completion/src/test/Test.java",
11821
			"package deprecation;"+
11575
	            "package test;\n" +
11822
			"public class ZZZType1 {\n"+
11576
	            "public class Test{\n"+
11823
			"  public static void foo1(){}\n"+
11577
	            "  void foo() {\n"+
11824
			"  /** @deprecated */\n"+
11578
	            "    AType a = \n"+
11825
			"  public static void foo2(){}\n"+
11579
	            "  }\n"+
11826
			"}");
11580
	            "}");
11827
	
11581
	    
11828
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11582
	    
11829
		String str = this.workingCopies[0].getSource();
11583
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11830
		String completeBehind = "ZZZType1.fo";
11584
	    requestor.setIgnored(CompletionProposal.METHOD_REF, true);
11831
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11585
	    requestor.setIgnored(CompletionProposal.FIELD_REF, true);
11832
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11586
	    requestor.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true);
11587
	    
11588
	    String str = this.wc.getSource();
11589
	    String completeBehind = "AType a = ";
11590
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11591
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11833
	
11592
	
11834
		assertResults(
11593
	    assertResults(
11835
				"foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11594
	            "expectedTypesSignatures={Ltest.AType;}\n"+
11836
				"foo2[METHOD_REF]{foo2(), Ldeprecation.ZZZType1;, ()V, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11595
	            "expectedTypesKeys={Ltest/AType;}",
11837
				requestor.getResults());
11596
	            requestor.getContext());
11597
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11598
			assertResults(
11599
		            "",
11600
		            requestor.getResults());
11601
	    } else {
11602
	    	assertResults(
11603
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11604
					"AType[TYPE_REF]{AType, test, Ltest.AType;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11605
		            requestor.getResults());
11606
	    }
11838
	} finally {
11607
	} finally {
11839
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11608
		if(aType != null) {
11840
		COMPLETION_PROJECT.setOptions(options);
11609
			aType.discardWorkingCopy();
11610
		}
11841
	}
11611
	}
11842
}
11612
}
11843
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11613
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95505
11844
public void testDeprecationCheck4() throws JavaModelException {
11614
public void testCompletionExpectedTypeOnEmptyToken4() throws JavaModelException {
11845
	Map options = COMPLETION_PROJECT.getOptions(true);
11615
	ICompilationUnit aType = null;
11846
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11847
	try {
11616
	try {
11848
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11617
		aType = getWorkingCopy(
11849
		COMPLETION_PROJECT.setOptions(options);
11618
	            "/Completion/src/test/AInterface.java",
11850
		
11619
	            "package test;\n" +
11851
		this.workingCopies = new ICompilationUnit[2];
11620
	            "public interface AInterface{\n"+
11852
		this.workingCopies[0] = getWorkingCopy(
11621
	            "}");
11853
			"/Completion/src/deprecation/Test.java",
11854
			"package deprecation;"+
11855
			"public class Test {\n"+
11856
			"  void foo() {"+
11857
			"    ZZZType1.fo\n"+
11858
			"  }"+
11859
			"}");
11860
		
11622
		
11861
		this.workingCopies[1] = getWorkingCopy(
11623
	    this.wc = getWorkingCopy(
11862
			"/Completion/src/deprecation/ZZZType1.java",
11624
	            "/Completion/src/test/Test.java",
11863
			"package deprecation;"+
11625
	            "package test;\n" +
11864
			"public class ZZZType1 {\n"+
11626
	            "public class Test{\n"+
11865
			"  public static void foo1(){}\n"+
11627
	            "  void foo() {\n"+
11866
			"  /** @deprecated */\n"+
11628
	            "    AInterface a = new \n"+
11867
			"  public static void foo2(){}\n"+
11629
	            "  }\n"+
11868
			"}");
11630
	            "}");
11869
	
11631
	    
11870
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11632
	    
11871
		String str = this.workingCopies[0].getSource();
11633
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11872
		String completeBehind = "ZZZType1.fo";
11634
	    
11873
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11635
	    String str = this.wc.getSource();
11874
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11636
	    String completeBehind = "AInterface a = new ";
11637
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11638
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11875
	
11639
	
11876
		assertResults(
11640
	    assertResults(
11877
				"foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11641
	            "expectedTypesSignatures={Ltest.AInterface;}\n"+
11878
				requestor.getResults());
11642
	            "expectedTypesKeys={Ltest/AInterface;}",
11643
	            requestor.getContext());
11644
	    
11645
	    if(CompletionEngine.NO_TYPE_COMPLETION_ON_EMPTY_TOKEN) {
11646
			assertResults(
11647
		            "AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11648
		            requestor.getResults());
11649
	    } else {
11650
	    	assertResults(
11651
		            "Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11652
					"AInterface[TYPE_REF]{AInterface, test, Ltest.AInterface;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11653
		            requestor.getResults());
11654
	    }
11879
	} finally {
11655
	} finally {
11880
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11656
		if(aType != null) {
11881
		COMPLETION_PROJECT.setOptions(options);
11657
			aType.discardWorkingCopy();
11658
		}
11882
	}
11659
	}
11883
}
11660
}
11884
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11661
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=99811
11885
public void testDeprecationCheck5() throws JavaModelException {
11662
public void testBug99811() throws JavaModelException {
11886
	Map options = COMPLETION_PROJECT.getOptions(true);
11663
	ICompilationUnit aType = null;
11887
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11664
    try {
11888
	try {
11665
    	this.wc = getWorkingCopy(
11889
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
11666
	            "/Completion/src/test/A.java",
11890
		COMPLETION_PROJECT.setOptions(options);
11667
	            "public abstract class A implements I {}");
11891
		
11668
    	
11892
		this.workingCopies = new ICompilationUnit[2];
11669
	    aType = getWorkingCopy(
11893
		this.workingCopies[0] = getWorkingCopy(
11670
	            "/Completion/src/test/I.java",
11894
			"/Completion/src/deprecation/Test.java",
11671
	            "public interface I {\n"+
11895
			"package deprecation;"+
11672
	            "  public class M extends A {}\n"+
11896
			"public class Test {\n"+
11673
	            "}");
11897
			"  ZZZType1.Inn\n"+
11898
			"}");
11899
		
11900
		this.workingCopies[1] = getWorkingCopy(
11901
			"/Completion/src/deprecation/ZZZType1.java",
11902
			"package deprecation;"+
11903
			"public class ZZZType1 {\n"+
11904
			"  public class Inner1 {}\n"+
11905
			"  /** @deprecated */\n"+
11906
			"  public class Inner2 {}\n"+
11907
			"}");
11908
	
11674
	
11909
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11675
	    CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11910
		String str = this.workingCopies[0].getSource();
11676
	    String str = this.wc.getSource();
11911
		String completeBehind = "ZZZType1.Inn";
11677
	    String completeBehind = "A";
11912
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11678
	    int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11913
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11679
	    this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
11914
	
11680
	
11915
		assertResults(
11681
		assertResults("", requestor.getResults());
11916
				"ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11917
				"ZZZType1.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.ZZZType1$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11918
				requestor.getResults());
11919
	} finally {
11682
	} finally {
11920
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11683
		if(aType != null) {
11921
		COMPLETION_PROJECT.setOptions(options);
11684
			aType.discardWorkingCopy();
11685
		}
11922
	}
11686
	}
11923
}
11687
}
11924
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11688
public void testCompletionImportedType1() throws JavaModelException {
11925
public void testDeprecationCheck6() throws JavaModelException {
11689
    this.workingCopies = new ICompilationUnit[2];
11926
	Map options = COMPLETION_PROJECT.getOptions(true);
11690
    this.workingCopies[0] = getWorkingCopy(
11927
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11691
		"/Completion/src/test/imported/ZZZZ.java",
11928
	try {
11692
		"package test.imported;"+
11929
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11693
		"public class ZZZZ {\n"+
11930
		COMPLETION_PROJECT.setOptions(options);
11694
		"  \n"+
11931
		
11695
		"}");
11932
		this.workingCopies = new ICompilationUnit[2];
11933
		this.workingCopies[0] = getWorkingCopy(
11934
			"/Completion/src/deprecation/Test.java",
11935
			"package deprecation;"+
11936
			"public class Test {\n"+
11937
			"  ZZZType1.Inn\n"+
11938
			"}");
11939
		
11696
		
11940
		this.workingCopies[1] = getWorkingCopy(
11697
	this.workingCopies[1] = getWorkingCopy(
11941
			"/Completion/src/deprecation/ZZZType1.java",
11698
			"/Completion/src/test/CompletionImportedType1.java",
11942
			"package deprecation;"+
11699
			"package test;"+
11943
			"public class ZZZType1 {\n"+
11700
			"public class CompletionImportedType1 {"+
11944
			"  public class Inner1 {}\n"+
11701
			"  ZZZ\n"+
11945
			"  /** @deprecated */\n"+
11946
			"  public class Inner2 {}\n"+
11947
			"}");
11702
			"}");
11703
11704
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11705
	String str = this.workingCopies[1].getSource();
11706
	String completeBehind = "ZZZ";
11707
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11708
	this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner);
11709
11710
	assertResults(
11711
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType1;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11712
			"ZZZZ[TYPE_REF]{test.imported.ZZZZ, test.imported, Ltest.imported.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11713
			requestor.getResults());
11714
}
11715
public void testCompletionImportedType2() throws JavaModelException {
11716
	this.workingCopies = new ICompilationUnit[4];
11717
	this.workingCopies[0] = getWorkingCopy(
11718
		"/Completion/src/test/imported1/ZZZZ.java",
11719
		"package test.imported1;"+
11720
		"public class ZZZZ {\n"+
11721
		"  \n"+
11722
		"}");
11723
	this.workingCopies[1] = getWorkingCopy(
11724
		"/Completion/src/test/imported2/ZZZZ.java",
11725
		"package test.imported2;"+
11726
		"public class ZZZZ {\n"+
11727
		"  \n"+
11728
		"}");
11729
	this.workingCopies[2] = getWorkingCopy(
11730
		"/Completion/src/test/imported3/ZZZZ.java",
11731
		"package test.imported3;"+
11732
		"public class ZZZZ {\n"+
11733
		"  \n"+
11734
		"}");
11735
	
11736
	this.workingCopies[3] = getWorkingCopy(
11737
		"/Completion/src/test/CompletionImportedType2.java",
11738
		"package test;"+
11739
		"import test.imported1.*;"+
11740
		"import test.imported2.*;"+
11741
		"import test.imported3.*;"+
11742
		"public class CompletionImportedType2 {"+
11743
		"  ZZZ\n"+
11744
		"}");
11745
	
11746
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11747
	String str = this.workingCopies[3].getSource();
11748
	String completeBehind = "ZZZ";
11749
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11750
	this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner);
11751
11752
	assertResults(
11753
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType2;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11754
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11755
			"ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11756
			"ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11757
			requestor.getResults());
11758
}
11759
public void testCompletionImportedType3() throws JavaModelException {
11760
	this.workingCopies = new ICompilationUnit[4];
11761
	this.workingCopies[0] = getWorkingCopy(
11762
		"/Completion/src/test/imported1/ZZZZ.java",
11763
		"package test.imported1;"+
11764
		"public class ZZZZ {\n"+
11765
		"  \n"+
11766
		"}");
11767
	this.workingCopies[1] = getWorkingCopy(
11768
		"/Completion/src/test/imported2/ZZZZ.java",
11769
		"package test.imported2;"+
11770
		"public class ZZZZ {\n"+
11771
		"  \n"+
11772
		"}");
11773
	this.workingCopies[2] = getWorkingCopy(
11774
		"/Completion/src/test/imported3/ZZZZ.java",
11775
		"package test.imported3;"+
11776
		"public class ZZZZ {\n"+
11777
		"  \n"+
11778
		"}");
11948
	
11779
	
11949
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11780
	this.workingCopies[3] = getWorkingCopy(
11950
		String str = this.workingCopies[0].getSource();
11781
		"/Completion/src/test/CompletionImportedType3.java",
11951
		String completeBehind = "ZZZType1.Inn";
11782
		"package test;"+
11952
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11783
		"import test.imported2.*;"+
11953
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11784
		"public class CompletionImportedType3 {"+
11785
		"  ZZZ\n"+
11786
			"}");
11954
	
11787
	
11955
		assertResults(
11788
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11956
				"ZZZType1.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.ZZZType1$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11789
	String str = this.workingCopies[3].getSource();
11957
				requestor.getResults());
11790
	String completeBehind = "ZZZ";
11958
	} finally {
11791
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11959
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11792
	this.workingCopies[3].codeComplete(cursorLocation, requestor, this.wcOwner);
11960
		COMPLETION_PROJECT.setOptions(options);
11793
11961
	}
11794
	assertResults(
11795
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType3;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11796
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11797
			"ZZZZ[TYPE_REF]{test.imported3.ZZZZ, test.imported3, Ltest.imported3.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11798
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11799
			requestor.getResults());
11962
}
11800
}
11963
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11801
public void testCompletionImportedType4() throws JavaModelException {
11964
public void testDeprecationCheck7() throws JavaModelException {
11802
	this.workingCopies = new ICompilationUnit[3];
11965
	Map options = COMPLETION_PROJECT.getOptions(true);
11803
	this.workingCopies[0] = getWorkingCopy(
11966
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11804
		"/Completion/src/test/imported1/ZZZZ.java",
11967
	try {
11805
		"package test.imported1;"+
11968
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
11806
		"public class ZZZZ {\n"+
11969
		COMPLETION_PROJECT.setOptions(options);
11807
		"  \n"+
11970
		
11808
		"}");
11971
		this.workingCopies = new ICompilationUnit[2];
11809
	this.workingCopies[1] = getWorkingCopy(
11972
		this.workingCopies[0] = getWorkingCopy(
11810
		"/Completion/src/test/imported2/ZZZZ.java",
11973
			"/Completion/src/deprecation/Test.java",
11811
		"package test.imported2;"+
11974
			"package deprecation;"+
11812
		"public class ZZZZ {\n"+
11975
			"public class Test {\n"+
11813
		"  \n"+
11976
			"  void foo() {"+
11814
		"}");
11977
			"    ZZZType1.fo\n"+
11978
			"  }"+
11979
			"}");
11980
		
11815
		
11981
		this.workingCopies[1] = getWorkingCopy(
11816
	this.workingCopies[2] = getWorkingCopy(
11982
			"/Completion/src/deprecation/ZZZType1.java",
11817
		"/Completion/src/test/CompletionImportedType4.java",
11983
			"package deprecation;"+
11818
		"package test;"+
11984
			"public class ZZZType1 {\n"+
11819
		"import test.imported1.*;"+
11985
			"  public static int foo1;\n"+
11820
		"public class CompletionImportedType4 {"+
11986
			"  /** @deprecated */\n"+
11821
		"  ZZZ\n"+
11987
			"  public static int foo2;\n"+
11822
		"}");
11988
			"}");
11989
	
11990
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11991
		String str = this.workingCopies[0].getSource();
11992
		String completeBehind = "ZZZType1.fo";
11993
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11994
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11995
	
11823
	
11996
		assertResults(
11824
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11997
				"foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11825
	String str = this.workingCopies[2].getSource();
11998
				"foo2[FIELD_REF]{foo2, Ldeprecation.ZZZType1;, I, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
11826
	String completeBehind = "ZZZ";
11999
				requestor.getResults());
11827
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12000
	} finally {
11828
	this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner);
12001
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11829
12002
		COMPLETION_PROJECT.setOptions(options);
11830
	assertResults(
12003
	}
11831
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType4;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11832
			"ZZZZ[TYPE_REF]{test.imported2.ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11833
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11834
			requestor.getResults());
12004
}
11835
}
12005
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11836
public void testCompletionImportedType5() throws JavaModelException {
12006
public void testDeprecationCheck8() throws JavaModelException {
11837
	this.workingCopies = new ICompilationUnit[3];
12007
	Map options = COMPLETION_PROJECT.getOptions(true);
11838
	this.workingCopies[0] = getWorkingCopy(
12008
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
11839
		"/Completion/src/test/imported1/ZZZZ.java",
11840
		"package test.imported1;"+
11841
		"public class ZZZZ {\n"+
11842
		"  \n"+
11843
		"}");
11844
	this.workingCopies[1] = getWorkingCopy(
11845
		"/Completion/src/test/imported2/ZZZZ.java",
11846
		"package test.imported2;"+
11847
		"public class ZZZZ {\n"+
11848
		"  \n"+
11849
		"}");
11850
		
11851
	this.workingCopies[2] = getWorkingCopy(
11852
		"/Completion/src/test/CompletionImportedType5.java",
11853
		"package test;"+
11854
		"import test.imported2.*;"+
11855
		"public class CompletionImportedType5 {"+
11856
		"  ZZZ\n"+
11857
		"}");
11858
11859
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11860
	String str = this.workingCopies[2].getSource();
11861
	String completeBehind = "ZZZ";
11862
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11863
	this.workingCopies[2].codeComplete(cursorLocation, requestor, this.wcOwner);
11864
11865
	assertResults(
11866
			"ZZZ[POTENTIAL_METHOD_DECLARATION]{ZZZ, Ltest.CompletionImportedType5;, ()V, ZZZ, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
11867
			"ZZZZ[TYPE_REF]{test.imported1.ZZZZ, test.imported1, Ltest.imported1.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
11868
			"ZZZZ[TYPE_REF]{ZZZZ, test.imported2, Ltest.imported2.ZZZZ;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11869
			requestor.getResults());
11870
}
11871
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
11872
public void testCamelCaseType1() throws JavaModelException {
11873
	this.oldOptions = JavaCore.getOptions();
12009
	try {
11874
	try {
12010
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11875
		Hashtable options = new Hashtable(oldOptions);
12011
		COMPLETION_PROJECT.setOptions(options);
11876
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
11877
		JavaCore.setOptions(options);
12012
		
11878
		
12013
		this.workingCopies = new ICompilationUnit[2];
11879
		this.workingCopies = new ICompilationUnit[3];
12014
		this.workingCopies[0] = getWorkingCopy(
11880
		this.workingCopies[0] = getWorkingCopy(
12015
			"/Completion/src/deprecation/Test.java",
11881
			"/Completion/src/camelcase/Test.java",
12016
			"package deprecation;"+
11882
			"package camelcase;"+
12017
			"public class Test {\n"+
11883
			"public class Test {\n"+
12018
			"  void foo() {"+
11884
			"  FF\n"+
12019
			"    ZZZType1.fo\n"+
12020
			"  }"+
12021
			"}");
11885
			"}");
12022
		
11886
	
12023
		this.workingCopies[1] = getWorkingCopy(
11887
		this.workingCopies[1] = getWorkingCopy(
12024
			"/Completion/src/deprecation/ZZZType1.java",
11888
			"/Completion/src/camelcase/FoFoFo.java",
12025
			"package deprecation;"+
11889
			"package camelcase;"+
12026
			"public class ZZZType1 {\n"+
11890
			"public class FoFoFo {\n"+
12027
			"  public static int foo1;\n"+
12028
			"  /** @deprecated */\n"+
12029
			"  public static int foo2;\n"+
12030
			"}");
11891
			"}");
12031
	
12032
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12033
		String str = this.workingCopies[0].getSource();
12034
		String completeBehind = "ZZZType1.fo";
12035
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12036
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12037
	
12038
		assertResults(
12039
				"foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12040
				requestor.getResults());
12041
	} finally {
12042
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12043
		COMPLETION_PROJECT.setOptions(options);
12044
	}
12045
}
12046
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
12047
public void testDeprecationCheck9() throws JavaModelException {
12048
	Map options = COMPLETION_PROJECT.getOptions(true);
12049
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12050
	try {
12051
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
12052
		COMPLETION_PROJECT.setOptions(options);
12053
		
11892
		
12054
		this.workingCopies = new ICompilationUnit[1];
11893
		this.workingCopies[2] = getWorkingCopy(
12055
		this.workingCopies[0] = getWorkingCopy(
11894
			"/Completion/src/camelcase/FFFTest.java",
12056
			"/Completion/src/deprecation/Test.java",
11895
			"package camelcase;"+
12057
			"package deprecation;"+
11896
			"public class FFFTest {\n"+
12058
			"public class Test {\n"+
12059
			"  public void bar1(){}\n"+
12060
			"  /** @deprecated */\n"+
12061
			"  public void bar2(){}\n"+
12062
			"  void foo() {"+
12063
			"    bar\n"+
12064
			"  }"+
12065
			"}");
11897
			"}");
12066
	
11898
	
12067
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11899
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12068
		String str = this.workingCopies[0].getSource();
11900
		String str = this.workingCopies[0].getSource();
12069
		String completeBehind = "bar";
11901
		String completeBehind = "FF";
12070
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11902
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12071
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11903
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12072
	
11904
	
12073
		assertResults(
11905
		assertResults(
12074
				"bar1[METHOD_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11906
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12075
				"bar2[METHOD_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11907
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11908
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12076
				requestor.getResults());
11909
				requestor.getResults());
12077
	} finally {
11910
	} finally {
12078
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11911
		JavaCore.setOptions(oldOptions);
12079
		COMPLETION_PROJECT.setOptions(options);
12080
	}
11912
	}
12081
}
11913
}
12082
11914
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12083
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11915
public void testCamelCaseType2() throws JavaModelException {
12084
public void testDeprecationCheck10() throws JavaModelException {
11916
	this.oldOptions = JavaCore.getOptions();
12085
	Map options = COMPLETION_PROJECT.getOptions(true);
12086
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12087
	try {
11917
	try {
12088
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11918
		Hashtable options = new Hashtable(oldOptions);
12089
		COMPLETION_PROJECT.setOptions(options);
11919
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
11920
		JavaCore.setOptions(options);
12090
		
11921
		
12091
		this.workingCopies = new ICompilationUnit[1];
11922
		this.workingCopies = new ICompilationUnit[3];
12092
		this.workingCopies[0] = getWorkingCopy(
11923
		this.workingCopies[0] = getWorkingCopy(
12093
			"/Completion/src/deprecation/Test.java",
11924
			"/Completion/src/camelcase/Test.java",
12094
			"package deprecation;"+
11925
			"package camelcase;"+
12095
			"public class Test {\n"+
11926
			"public class Test {\n"+
12096
			"  public void bar1(){}\n"+
11927
			"  camelcase.FF\n"+
12097
			"  /** @deprecated */\n"+
11928
			"}");
12098
			"  public void bar2(){}\n"+
11929
	
12099
			"  void foo() {"+
11930
		this.workingCopies[1] = getWorkingCopy(
12100
			"    bar\n"+
11931
			"/Completion/src/camelcase/FoFoFo.java",
12101
			"  }"+
11932
			"package camelcase;"+
11933
			"public class FoFoFo {\n"+
11934
			"}");
11935
		
11936
		this.workingCopies[2] = getWorkingCopy(
11937
			"/Completion/src/camelcase/FFFTest.java",
11938
			"package camelcase;"+
11939
			"public class FFFTest {\n"+
12102
			"}");
11940
			"}");
12103
	
11941
	
12104
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11942
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12105
		String str = this.workingCopies[0].getSource();
11943
		String str = this.workingCopies[0].getSource();
12106
		String completeBehind = "bar";
11944
		String completeBehind = "FF";
12107
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11945
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12108
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11946
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12109
	
11947
	
12110
		assertResults(
11948
		assertResults(
12111
				"bar1[METHOD_REF]{bar1(), Ldeprecation.Test;, ()V, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11949
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" +
12112
				"bar2[METHOD_REF]{bar2(), Ldeprecation.Test;, ()V, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11950
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12113
				requestor.getResults());
11951
				requestor.getResults());
12114
	} finally {
11952
	} finally {
12115
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11953
		JavaCore.setOptions(oldOptions);
12116
		COMPLETION_PROJECT.setOptions(options);
12117
	}
11954
	}
12118
}
11955
}
12119
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11956
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12120
public void testDeprecationCheck11() throws JavaModelException {
11957
public void testCamelCaseType3() throws JavaModelException {
12121
	Map options = COMPLETION_PROJECT.getOptions(true);
11958
	this.oldOptions = JavaCore.getOptions();
12122
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12123
	try {
11959
	try {
12124
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
11960
		Hashtable options = new Hashtable(oldOptions);
12125
		COMPLETION_PROJECT.setOptions(options);
11961
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12126
		
11962
		JavaCore.setOptions(options);
11963
			
12127
		this.workingCopies = new ICompilationUnit[1];
11964
		this.workingCopies = new ICompilationUnit[1];
12128
		this.workingCopies[0] = getWorkingCopy(
11965
		this.workingCopies[0] = getWorkingCopy(
12129
			"/Completion/src/deprecation/Test.java",
11966
			"/Completion/src/camelcase/Test.java",
12130
			"package deprecation;"+
11967
			"package camelcase;"+
12131
			"public class Test {\n"+
11968
			"public class Test {\n"+
12132
			"  public int bar1;\n"+
11969
			"  /**/FF\n"+
12133
			"  /** @deprecated */\n"+
11970
			"}\n"+
12134
			"  public int bar2;\n"+
11971
			"class FoFoFo {\n"+
12135
			"  void foo() {"+
11972
			"}\n"+
12136
			"    bar\n"+
11973
			"class FFFTest {\n"+
12137
			"  }"+
12138
			"}");
11974
			"}");
12139
	
11975
	
12140
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
11976
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12141
		String str = this.workingCopies[0].getSource();
11977
		String str = this.workingCopies[0].getSource();
12142
		String completeBehind = "bar";
11978
		String completeBehind = "/**/FF";
12143
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
11979
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12144
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
11980
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12145
	
11981
	
12146
		assertResults(
11982
		assertResults(
12147
				"bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11983
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12148
				"bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
11984
				"FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
11985
				"FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12149
				requestor.getResults());
11986
				requestor.getResults());
12150
	} finally {
11987
	} finally {
12151
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
11988
		JavaCore.setOptions(oldOptions);
12152
		COMPLETION_PROJECT.setOptions(options);
12153
	}
11989
	}
12154
}
11990
}
12155
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
11991
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12156
public void testDeprecationCheck12() throws JavaModelException {
11992
public void testCamelCaseType4() throws JavaModelException {
12157
	Map options = COMPLETION_PROJECT.getOptions(true);
11993
	this.oldOptions = JavaCore.getOptions();
12158
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12159
	try {
11994
	try {
12160
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
11995
		Hashtable options = new Hashtable(oldOptions);
12161
		COMPLETION_PROJECT.setOptions(options);
11996
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
11997
		JavaCore.setOptions(options);
12162
		
11998
		
12163
		this.workingCopies = new ICompilationUnit[1];
11999
		this.workingCopies = new ICompilationUnit[3];
12164
		this.workingCopies[0] = getWorkingCopy(
12000
		this.workingCopies[0] = getWorkingCopy(
12165
			"/Completion/src/deprecation/Test.java",
12001
			"/Completion/src/camelcase/Test.java",
12166
			"package deprecation;"+
12002
			"package camelcase;"+
12167
			"public class Test {\n"+
12003
			"public class Test {\n"+
12168
			"  public int bar1;\n"+
12004
			"  FF\n"+
12169
			"  /** @deprecated */\n"+
12005
			"}");
12170
			"  public int bar2;\n"+
12006
	
12171
			"  void foo() {"+
12007
		this.workingCopies[1] = getWorkingCopy(
12172
			"    bar\n"+
12008
			"/Completion/src/camelcase/Member1.java",
12173
			"  }"+
12009
			"package camelcase;"+
12010
			"public class Member1 {\n"+
12011
			"  public class FoFoFo {\n"+
12012
			"  }\n"+
12013
			"}");
12014
		
12015
		this.workingCopies[2] = getWorkingCopy(
12016
			"/Completion/src/camelcase/Member2.java",
12017
			"package camelcase;"+
12018
			"public class Member2 {\n"+
12019
			"  public class FFFTest {\n"+
12020
			"  }\n"+
12174
			"}");
12021
			"}");
12175
	
12022
	
12176
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12023
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12177
		String str = this.workingCopies[0].getSource();
12024
		String str = this.workingCopies[0].getSource();
12178
		String completeBehind = "bar";
12025
		String completeBehind = "FF";
12179
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12026
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12180
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12027
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12181
	
12028
	
12182
		assertResults(
12029
		assertResults(
12183
				"bar1[FIELD_REF]{bar1, Ldeprecation.Test;, I, bar1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12030
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12184
				"bar2[FIELD_REF]{bar2, Ldeprecation.Test;, I, bar2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12031
				"Member1.FoFoFo[TYPE_REF]{camelcase.Member1.FoFoFo, camelcase, Lcamelcase.Member1$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_NON_RESTRICTED) + "}\n" +
12032
				"Member2.FFFTest[TYPE_REF]{camelcase.Member2.FFFTest, camelcase, Lcamelcase.Member2$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12185
				requestor.getResults());
12033
				requestor.getResults());
12186
	} finally {
12034
	} finally {
12187
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12035
		JavaCore.setOptions(oldOptions);
12188
		COMPLETION_PROJECT.setOptions(options);
12189
	}
12036
	}
12190
}
12037
}
12191
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
12038
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12192
public void testDeprecationCheck13() throws JavaModelException {
12039
public void testCamelCaseType5() throws JavaModelException {
12193
	Map options = COMPLETION_PROJECT.getOptions(true);
12040
	this.oldOptions = JavaCore.getOptions();
12194
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12195
	try {
12041
	try {
12196
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED);
12042
		Hashtable options = new Hashtable(oldOptions);
12197
		COMPLETION_PROJECT.setOptions(options);
12043
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12044
		JavaCore.setOptions(options);
12198
		
12045
		
12199
		this.workingCopies = new ICompilationUnit[1];
12046
		this.workingCopies = new ICompilationUnit[1];
12200
		this.workingCopies[0] = getWorkingCopy(
12047
		this.workingCopies[0] = getWorkingCopy(
12201
			"/Completion/src/deprecation/Test.java",
12048
			"/Completion/src/camelcase/Test.java",
12202
			"package deprecation;"+
12049
			"package camelcase;"+
12203
			"public class Test {\n"+
12050
			"public class Test {\n"+
12204
			"  class Inner1 {}\n"+
12051
			"  public class FoFoFo {\n"+
12205
			"  /** @deprecated */\n"+
12052
			"    public class FFFTest {\n"+
12206
			"  class Inner2 {}\n"+
12053
			"      FF\n"+
12207
			"  void foo() {"+
12054
			"    }\n"+
12208
			"    Inn\n"+
12055
			"  }\n"+
12209
			"  }"+
12210
			"}");
12056
			"}");
12211
	
12057
	
12212
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12058
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12213
		String str = this.workingCopies[0].getSource();
12059
		String str = this.workingCopies[0].getSource();
12214
		String completeBehind = "Inn";
12060
		String completeBehind = "FF";
12215
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12061
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12216
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12062
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12217
	
12063
	
12218
		assertResults(
12064
		assertResults(
12219
				"Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12065
				"FF[POTENTIAL_METHOD_DECLARATION]{FF, Lcamelcase.Test$FoFoFo$FFFTest;, ()V, FF, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12220
				"Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12066
				"Test.FoFoFo[TYPE_REF]{FoFoFo, camelcase, Lcamelcase.Test$FoFoFo;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12067
				"Test.FoFoFo.FFFTest[TYPE_REF]{FFFTest, camelcase, Lcamelcase.Test$FoFoFo$FFFTest;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12221
				requestor.getResults());
12068
				requestor.getResults());
12222
	} finally {
12069
	} finally {
12223
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12070
		JavaCore.setOptions(oldOptions);
12224
		COMPLETION_PROJECT.setOptions(options);
12225
	}
12071
	}
12226
}
12072
}
12227
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
12073
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12228
public void testDeprecationCheck14() throws JavaModelException {
12074
public void testCamelCaseMethod1() throws JavaModelException {
12229
	Map options = COMPLETION_PROJECT.getOptions(true);
12075
	this.oldOptions = JavaCore.getOptions();
12230
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12231
	try {
12076
	try {
12232
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
12077
		Hashtable options = new Hashtable(oldOptions);
12233
		COMPLETION_PROJECT.setOptions(options);
12078
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12079
		JavaCore.setOptions(options);
12234
		
12080
		
12235
		this.workingCopies = new ICompilationUnit[2];
12081
	this.workingCopies = new ICompilationUnit[1];
12236
		this.workingCopies[0] = getWorkingCopy(
12082
		this.workingCopies[0] = getWorkingCopy(
12237
			"/Completion/src/deprecation/Test.java",
12083
			"/Completion/src/camelcase/Test.java",
12238
			"package deprecation;"+
12084
			"package camelcase;"+
12239
			"public class Test {\n"+
12085
			"public class Test {\n"+
12240
			"  class Inner1 {}\n"+
12086
			"  void oneTwoThree(){}\n"+
12241
			"  /** @deprecated */\n"+
12087
			"  void oTTMethod(){}\n"+
12242
			"  class Inner2 {}\n"+
12088
			"  void foo() {\n"+
12243
			"  void foo() {"+
12089
			"    oTT\n"+
12244
			"    Inn\n"+
12090
			"  }\n"+
12245
			"  }"+
12246
			"}");
12091
			"}");
12247
	
12092
	
12248
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12093
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12249
		String str = this.workingCopies[0].getSource();
12094
		String str = this.workingCopies[0].getSource();
12250
		String completeBehind = "Inn";
12095
		String completeBehind = "oTT";
12251
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12096
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12252
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12097
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12253
	
12098
	
12254
		assertResults(
12099
		assertResults(
12255
				"Test.Inner1[TYPE_REF]{Inner1, deprecation, Ldeprecation.Test$Inner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12100
				"oneTwoThree[METHOD_REF]{oneTwoThree(), Lcamelcase.Test;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12256
				"Test.Inner2[TYPE_REF]{Inner2, deprecation, Ldeprecation.Test$Inner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12101
				"oTTMethod[METHOD_REF]{oTTMethod(), Lcamelcase.Test;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12257
				requestor.getResults());
12102
				requestor.getResults());
12258
	} finally {
12103
	} finally {
12259
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12104
		JavaCore.setOptions(oldOptions);
12260
		COMPLETION_PROJECT.setOptions(options);
12261
	}
12105
	}
12262
}
12106
}
12263
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
12107
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12264
public void testDeprecationCheck15() throws JavaModelException {
12108
public void testCamelCaseField1() throws JavaModelException {
12265
	Map options = COMPLETION_PROJECT.getOptions(true);
12109
	this.oldOptions = JavaCore.getOptions();
12266
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12267
	try {
12110
	try {
12268
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
12111
		Hashtable options = new Hashtable(oldOptions);
12269
		COMPLETION_PROJECT.setOptions(options);
12112
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12113
		JavaCore.setOptions(options);
12270
		
12114
		
12271
		this.workingCopies = new ICompilationUnit[2];
12115
		this.workingCopies = new ICompilationUnit[1];
12272
		this.workingCopies[0] = getWorkingCopy(
12116
		this.workingCopies[0] = getWorkingCopy(
12273
			"/Completion/src/deprecation/Test.java",
12117
			"/Completion/src/camelcase/Test.java",
12274
			"package deprecation;"+
12118
			"package camelcase;"+
12275
			"public class Test {\n"+
12119
			"public class Test {\n"+
12276
			"  void foo() {"+
12120
			"  int oneTwoThree;\n"+
12277
			"    ZZZType1.foo\n"+
12121
			"  int oTTField;\n"+
12278
			"  }"+
12122
			"  void foo() {\n"+
12279
			"}");
12123
			"    oTT\n"+
12280
		
12124
			"  }\n"+
12281
		this.workingCopies[1] = getWorkingCopy(
12282
			"/Completion/src/deprecation/ZZZType1.java",
12283
			"package deprecation;"+
12284
			"/** @deprecated */\n"+
12285
			"public class ZZZType1 {\n"+
12286
			"  public static int foo1;\n"+
12287
			"  public static int foo2;\n"+
12288
			"}");
12125
			"}");
12289
	
12126
	
12290
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12127
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12291
		String str = this.workingCopies[0].getSource();
12128
		String str = this.workingCopies[0].getSource();
12292
		String completeBehind = "ZZZType1.foo";
12129
		String completeBehind = "oTT";
12293
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12130
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12294
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12131
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12295
	
12132
	
12296
		assertResults(
12133
		assertResults(
12297
				"",
12134
				"oneTwoThree[FIELD_REF]{oneTwoThree, Lcamelcase.Test;, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12135
				"oTTField[FIELD_REF]{oTTField, Lcamelcase.Test;, I, oTTField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12298
				requestor.getResults());
12136
				requestor.getResults());
12299
	} finally {
12137
	} finally {
12300
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12138
		JavaCore.setOptions(oldOptions);
12301
		COMPLETION_PROJECT.setOptions(options);
12302
	}
12139
	}
12303
}
12140
}
12304
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127296
12141
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12305
public void testDeprecationCheck16() throws JavaModelException {
12142
public void testCamelCaseLocalVariable1() throws JavaModelException {
12306
	Map options = COMPLETION_PROJECT.getOptions(true);
12143
	this.oldOptions = JavaCore.getOptions();
12307
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12308
	try {
12144
	try {
12309
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
12145
		Hashtable options = new Hashtable(oldOptions);
12310
		COMPLETION_PROJECT.setOptions(options);
12146
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12147
		JavaCore.setOptions(options);
12311
		
12148
		
12312
		this.workingCopies = new ICompilationUnit[1];
12149
		this.workingCopies = new ICompilationUnit[1];
12313
		this.workingCopies[0] = getWorkingCopy(
12150
		this.workingCopies[0] = getWorkingCopy(
12314
			"/Completion/src/deprecation/Test.java",
12151
			"/Completion/src/camelcase/Test.java",
12315
			"package deprecation;"+
12152
			"package camelcase;"+
12316
			"/** @deprecated */\n"+
12317
			"public class ZZZType1 {\n"+
12318
			"}"+
12319
			"public class Test {\n"+
12153
			"public class Test {\n"+
12320
			"  void foo() {"+
12154
			"  void foo() {\n"+
12321
			"    ZZZTy\n"+
12155
			"    int oneTwoThree;\n"+
12322
			"  }"+
12156
			"    int oTTLocal;\n"+
12157
			"    oTT\n"+
12158
			"  }\n"+
12323
			"}");
12159
			"}");
12324
	
12160
	
12325
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12161
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12326
		String str = this.workingCopies[0].getSource();
12162
		String str = this.workingCopies[0].getSource();
12327
		String completeBehind = "ZZZTy";
12163
		String completeBehind = "oTT";
12328
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12164
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12329
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12165
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12330
	
12166
	
12331
		assertResults(
12167
		assertResults(
12332
				"ZZZType1[TYPE_REF]{ZZZType1, deprecation, Ldeprecation.ZZZType1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12168
				"oneTwoThree[LOCAL_VARIABLE_REF]{oneTwoThree, null, I, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12169
				"oTTLocal[LOCAL_VARIABLE_REF]{oTTLocal, null, I, oTTLocal, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12333
				requestor.getResults());
12170
				requestor.getResults());
12334
	} finally {
12171
	} finally {
12335
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12172
		JavaCore.setOptions(oldOptions);
12336
		COMPLETION_PROJECT.setOptions(options);
12337
	}
12173
	}
12338
}
12174
}
12339
12175
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
12340
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127628
12176
public void testCamelCaseMethodDeclaration1() throws JavaModelException {
12341
public void testDeprecationCheck17() throws JavaModelException {
12177
	this.oldOptions = JavaCore.getOptions();
12342
	Map options = COMPLETION_PROJECT.getOptions(true);
12343
	Object timeout = options.get(JavaCore.CODEASSIST_DEPRECATION_CHECK);
12344
	try {
12178
	try {
12345
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.ENABLED);
12179
		Hashtable options = new Hashtable(oldOptions);
12346
		COMPLETION_PROJECT.setOptions(options);
12180
		options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
12181
		JavaCore.setOptions(options);
12347
		
12182
		
12348
		this.workingCopies = new ICompilationUnit[1];
12183
		this.workingCopies = new ICompilationUnit[2];
12349
		this.workingCopies[0] = getWorkingCopy(
12184
		this.workingCopies[0] = getWorkingCopy(
12350
			"/Completion/src/deprecation/Test.java",
12185
			"/Completion/src/camelcase/Test.java",
12351
			"package deprecation;"+
12186
			"package camelcase;"+
12352
			"public class Test {\n"+
12187
			"public class Test extends SuperClass {\n"+
12353
			"  Bug127628Ty\n"+
12188
			"  oTT\n"+
12189
			"}");
12190
		
12191
		this.workingCopies[1] = getWorkingCopy(
12192
			"/Completion/src/camelcase/SuperClass.java",
12193
			"package camelcase;"+
12194
			"public class SuperClass {\n"+
12195
			"  public void oneTwoThree(){}\n"+
12196
			"  public void oTTMethod(){}\n"+
12354
			"}");
12197
			"}");
12355
	
12198
	
12356
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12199
		CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12357
		String str = this.workingCopies[0].getSource();
12200
		String str = this.workingCopies[0].getSource();
12358
		String completeBehind = "Bug127628Ty";
12201
		String completeBehind = "oTT";
12359
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12202
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12360
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12203
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12361
	
12204
	
12362
		assertResults(
12205
		assertResults(
12363
				"Bug127628Ty[POTENTIAL_METHOD_DECLARATION]{Bug127628Ty, Ldeprecation.Test;, ()V, Bug127628Ty, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12206
				"oTT[POTENTIAL_METHOD_DECLARATION]{oTT, Lcamelcase.Test;, ()V, oTT, null, " + (R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
12364
				"Bug127628Type1.Bug127628TypeInner1[TYPE_REF]{deprecation.Bug127628Type1.Bug127628TypeInner1, deprecation, Ldeprecation.Bug127628Type1$Bug127628TypeInner1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12207
				"oneTwoThree[METHOD_DECLARATION]{public void oneTwoThree(), Lcamelcase.SuperClass;, ()V, oneTwoThree, null, " + (R_DEFAULT + R_INTERESTING + R_CAMEL_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
12365
				"Bug127628Type2.Bug127628TypeInner2[TYPE_REF]{deprecation.Bug127628Type2.Bug127628TypeInner2, deprecation, Ldeprecation.Bug127628Type2$Bug127628TypeInner2;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12208
				"oTTMethod[METHOD_DECLARATION]{public void oTTMethod(), Lcamelcase.SuperClass;, ()V, oTTMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12366
				"Bug127628Type1[TYPE_REF]{Bug127628Type1, deprecation, Ldeprecation.Bug127628Type1;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
12367
				requestor.getResults());
12209
				requestor.getResults());
12368
	} finally {
12210
	} finally {
12369
		options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout);
12211
		JavaCore.setOptions(oldOptions);
12370
		COMPLETION_PROJECT.setOptions(options);
12371
	}
12212
	}
12372
}
12213
}
12373
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139937
12214
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12374
public void testEvaluationContextCompletion() throws JavaModelException {
12215
public void testLabel1() throws JavaModelException {
12375
	class EvaluationContextCompletionRequestor extends CompletionRequestor {
12216
	this.workingCopies = new ICompilationUnit[1];
12376
		public boolean acceptContext;
12217
	this.workingCopies[0] = getWorkingCopy(
12377
		public void acceptContext(CompletionContext context) {
12218
		"/Completion/src/label/Test.java",
12378
			this.acceptContext = context != null;
12219
		"package label;"+
12379
		}
12220
		"public class Test {\n"+
12380
		public void accept(CompletionProposal proposal) {
12221
		"  void foo() {\n"+
12381
			// Do nothing
12222
		"    label1 : for(;;) foo();\n"+
12382
		}
12223
		"    label2 : for(;;)\n"+
12383
	}
12224
		"      label3 : for(;;) {\n"+
12384
	String start = "";
12225
		"        label4 : for(;;) {\n"+
12385
	IJavaProject javaProject = getJavaProject("Completion");
12226
		"          break lab\n"+
12386
	IEvaluationContext context = javaProject.newEvaluationContext();
12227
		"        }\n"+
12387
    EvaluationContextCompletionRequestor rc = new EvaluationContextCompletionRequestor();
12228
		"      }\n"+
12388
	context.codeComplete(start, start.length(), rc);
12229
		"  }\n"+
12389
	
12230
		"}");
12390
	assertTrue("acceptContext() method isn't call", rc.acceptContext);
12231
12232
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12233
	String str = this.workingCopies[0].getSource();
12234
	String completeBehind = "lab";
12235
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12236
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12237
12238
	assertResults(
12239
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12240
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12241
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12242
			requestor.getResults());
12243
}
12244
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12245
public void testLabel2() throws JavaModelException {
12246
	this.workingCopies = new ICompilationUnit[1];
12247
	this.workingCopies[0] = getWorkingCopy(
12248
		"/Completion/src/label/Test.java",
12249
		"package label;"+
12250
		"public class Test {\n"+
12251
		"  void foo() {\n"+
12252
		"    #\n"+
12253
		"    label1 : for(;;) foo();\n"+
12254
		"    label2 : for(;;)\n"+
12255
		"      label3 : for(;;) {\n"+
12256
		"        label4 : for(;;) {\n"+
12257
		"          break lab\n"+
12258
		"        }\n"+
12259
		"      }\n"+
12260
		"  }\n"+
12261
		"}");
12262
12263
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12264
	String str = this.workingCopies[0].getSource();
12265
	String completeBehind = "lab";
12266
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12267
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12268
12269
	assertResults(
12270
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12271
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12272
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12273
			requestor.getResults());
12274
}
12275
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12276
public void testLabel3() throws JavaModelException {
12277
	this.workingCopies = new ICompilationUnit[1];
12278
	this.workingCopies[0] = getWorkingCopy(
12279
		"/Completion/src/label/Test.java",
12280
		"package label;"+
12281
		"public class Test {\n"+
12282
		"  void foo() {\n"+
12283
		"    label1 : for(;;) foo();\n"+
12284
		"    label2 : for(;;)\n"+
12285
		"      label3 : for(;;) {\n"+
12286
		"        label4 : for(;;) {\n"+
12287
		"          break lab\n"+
12288
		"  }\n"+
12289
		"}");
12290
12291
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12292
	String str = this.workingCopies[0].getSource();
12293
	String completeBehind = "lab";
12294
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12295
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12296
12297
	assertResults(
12298
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12299
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12300
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12301
			requestor.getResults());
12302
}
12303
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12304
public void testLabel4() throws JavaModelException {
12305
	this.workingCopies = new ICompilationUnit[1];
12306
	this.workingCopies[0] = getWorkingCopy(
12307
		"/Completion/src/label/Test.java",
12308
		"package label;"+
12309
		"public class Test {\n"+
12310
		"  void foo() {\n"+
12311
		"    #\n"+
12312
		"    label1 : for(;;) foo();\n"+
12313
		"    label2 : for(;;)\n"+
12314
		"      label3 : for(;;) {\n"+
12315
		"        label4 : for(;;) {\n"+
12316
		"          break lab\n"+
12317
		"  }\n"+
12318
		"}");
12319
12320
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12321
	String str = this.workingCopies[0].getSource();
12322
	String completeBehind = "lab";
12323
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12324
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12325
12326
	assertResults(
12327
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12328
			"label3[LABEL_REF]{label3, null, null, label3, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
12329
			"label4[LABEL_REF]{label4, null, null, label4, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12330
			requestor.getResults());
12331
}
12332
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12333
public void testLabel5() throws JavaModelException {
12334
	this.workingCopies = new ICompilationUnit[1];
12335
	this.workingCopies[0] = getWorkingCopy(
12336
		"/Completion/src/label/Test.java",
12337
		"package label;"+
12338
		"public class Test {\n" + 
12339
		"  void foo() {\n" + 
12340
		"    #\n" + 
12341
 		"    label1 : for(;;) {\n" + 
12342
 		"      class X {\n" + 
12343
 		"        void foo() {\n" + 
12344
 		"          label2 : for(;;) foo();\n" + 
12345
 		"        }\n" + 
12346
 		"      }\n" + 
12347
 		"      continue lab\n" + 
12348
 		"    }\n" + 
12349
		"  }\n" + 
12350
		"}\n");
12351
12352
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12353
	String str = this.workingCopies[0].getSource();
12354
	String completeBehind = "lab";
12355
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12356
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12357
12358
	assertResults(
12359
			"label1[LABEL_REF]{label1, null, null, label1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12360
			requestor.getResults());
12361
}
12362
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072
12363
public void testLabel6() throws JavaModelException {
12364
	this.workingCopies = new ICompilationUnit[1];
12365
	this.workingCopies[0] = getWorkingCopy(
12366
		"/Completion/src/label/Test.java",
12367
		"package label;"+
12368
		"public class Test {\n" + 
12369
		"  void foo() {\n" + 
12370
		"    #\n" + 
12371
 		"    label1 : for(;;) {\n" + 
12372
 		"      class X {\n" + 
12373
 		"        void foo() {\n" + 
12374
 		"          label2 : for(;;) {\n" + 
12375
 		"            continue lab\n" + 
12376
 		"          }\n" + 
12377
 		"        }\n" + 
12378
 		"      }\n" + 
12379
 		"    }\n" + 
12380
		"  }\n" + 
12381
		"}\n");
12382
12383
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
12384
	String str = this.workingCopies[0].getSource();
12385
	String completeBehind = "lab";
12386
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
12387
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
12388
12389
	assertResults(
12390
			"label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
12391
			requestor.getResults());
12391
}
12392
}
12392
}
12393
}
(-)src/org/eclipse/jdt/core/tests/model/WorkingCopySearchTests.java (-1 lines)
Lines 316-322 Link Here
316
				IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
316
				IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
317
				null
317
				null
318
			);
318
			);
319
			this.discard = false;
320
			assertSearchResults(
319
			assertSearchResults(
321
				"Unexpected all type names",
320
				"Unexpected all type names",
322
				"p2.A2\n" + 
321
				"p2.A2\n" + 
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-9 / +22 lines)
Lines 47-53 Link Here
47
	// working copies usage
47
	// working copies usage
48
	protected ICompilationUnit[] workingCopies;
48
	protected ICompilationUnit[] workingCopies;
49
	protected WorkingCopyOwner wcOwner;
49
	protected WorkingCopyOwner wcOwner;
50
	protected boolean discard;
51
	
50
	
52
	// infos for invalid results
51
	// infos for invalid results
53
	protected int tabs = 2;
52
	protected int tabs = 2;
Lines 187-194 Link Here
187
	 * @return a test suite ({@link Test}) 
186
	 * @return a test suite ({@link Test}) 
188
	 */
187
	 */
189
	public static Test buildModelTestSuite(Class evaluationTestClass) {
188
	public static Test buildModelTestSuite(Class evaluationTestClass) {
189
		return buildModelTestSuite(evaluationTestClass, 0/* do not sort*/);
190
	}
191
192
	/**
193
	 * Build a test suite with all tests computed from public methods starting with "test"
194
	 * found in the given test class and sorted in alphabetical order.
195
	 * Test suite name is the name of the given test class.
196
	 * 
197
	 * Note that this lis maybe reduced using some mechanisms detailed in {@link #buildTestsList(Class)} method.
198
	 * 
199
	 * This test suite differ from this computed in {@link TestCase} in the fact that this is
200
	 * a {@link Suite} instead of a simple framework {@link TestSuite}.
201
	 * 
202
	 * @param evaluationTestClass
203
	 * @return a test suite ({@link Test}) 
204
	 */
205
	public static Test buildModelTestSuite(Class evaluationTestClass, int sort) {
190
		TestSuite suite = new Suite(evaluationTestClass.getName());
206
		TestSuite suite = new Suite(evaluationTestClass.getName());
191
		List tests = buildTestsList(evaluationTestClass);
207
		List tests = buildTestsList(evaluationTestClass, 0, sort);
192
		for (int index=0, size=tests.size(); index<size; index++) {
208
		for (int index=0, size=tests.size(); index<size; index++) {
193
			suite.addTest((Test)tests.get(index));
209
			suite.addTest((Test)tests.get(index));
194
		}
210
		}
Lines 2132-2138 Link Here
2132
	}
2148
	}
2133
	protected void setUp () throws Exception {
2149
	protected void setUp () throws Exception {
2134
		super.setUp();
2150
		super.setUp();
2135
		this.discard = true;
2136
		if (NameLookup.VERBOSE || BasicSearchEngine.VERBOSE || JavaModelManager.VERBOSE) {
2151
		if (NameLookup.VERBOSE || BasicSearchEngine.VERBOSE || JavaModelManager.VERBOSE) {
2137
			System.out.println("--------------------------------------------------------------------------------");
2152
			System.out.println("--------------------------------------------------------------------------------");
2138
			System.out.println("Running test "+getName()+"...");
2153
			System.out.println("Running test "+getName()+"...");
Lines 2237-2249 Link Here
2237
	}
2252
	}
2238
	protected void tearDown() throws Exception {
2253
	protected void tearDown() throws Exception {
2239
		super.tearDown();
2254
		super.tearDown();
2240
		if (this.discard) {
2255
		if (this.workingCopies != null) {
2241
			if (this.workingCopies != null) {
2256
			discardWorkingCopies(this.workingCopies);
2242
				discardWorkingCopies(this.workingCopies);
2257
			this.workingCopies = null;
2243
				this.workingCopies = null;
2244
			}
2245
			this.wcOwner = null;
2246
		}
2258
		}
2259
		this.wcOwner = null;
2247
	}
2260
	}
2248
	/* (non-Javadoc)
2261
	/* (non-Javadoc)
2249
	 * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
2262
	 * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (-1 / +1 lines)
Lines 2797-2803 Link Here
2797
	public void test0500() throws JavaModelException {
2797
	public void test0500() throws JavaModelException {
2798
		ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
2798
		ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
2799
		IJavaProject project = sourceUnit.getJavaProject();
2799
		IJavaProject project = sourceUnit.getJavaProject();
2800
		Map originalOptions = project.getOptions(true);
2800
		Map originalOptions = project.getOptions(false);
2801
		try {
2801
		try {
2802
			project.setOption(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.ERROR);
2802
			project.setOption(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.ERROR);
2803
			project.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);
2803
			project.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-1 / +1 lines)
Lines 2861-2867 Link Here
2861
	public void test0500() throws JavaModelException {
2861
	public void test0500() throws JavaModelException {
2862
		ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
2862
		ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
2863
		IJavaProject project = sourceUnit.getJavaProject();
2863
		IJavaProject project = sourceUnit.getJavaProject();
2864
		Map originalOptions = project.getOptions(true);
2864
		Map originalOptions = project.getOptions(false);
2865
		try {
2865
		try {
2866
			project.setOption(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.ERROR);
2866
			project.setOption(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.ERROR);
2867
			project.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);
2867
			project.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);

Return to bug 144504