View | Details | Raw Unified | Return to bug 100772 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-11 / +125 lines)
Lines 44-52 Link Here
44
	static {
44
	static {
45
//		org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
45
//		org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
46
//		org.eclipse.jdt.internal.codeassist.SelectionEngine.DEBUG = true;
46
//		org.eclipse.jdt.internal.codeassist.SelectionEngine.DEBUG = true;
47
//		TESTS_PREFIX =  "testBug97547";
47
//		TESTS_PREFIX =  "testBug100772_MultipleClasses";
48
//		TESTS_NAMES = new String[] { "testBug100772_ClassAndSubclass04" };
48
//		TESTS_NAMES = new String[] { "testBug100772_ClassAndSubclass04" };
49
//		TESTS_NUMBERS = new int[] { 100695, 100772 };
49
//		TESTS_NUMBERS = new int[] { 100772 };
50
//		TESTS_RANGE = new int[] { 83304, -1 };
50
//		TESTS_RANGE = new int[] { 83304, -1 };
51
		}
51
		}
52
52
Lines 3892-3898 Link Here
3892
		);
3892
		);
3893
		IType type = workingCopies[0].getType("Test");
3893
		IType type = workingCopies[0].getType("Test");
3894
		IMethod method = type.getMethods()[0];
3894
		IMethod method = type.getMethods()[0];
3895
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3895
		search(method, UI_DECLARATIONS);
3896
		this.discard = false;
3896
		this.discard = false;
3897
		assertSearchResults(
3897
		assertSearchResults(
3898
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3898
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 3904-3910 Link Here
3904
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3904
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3905
		IType type = workingCopies[0].getType("Test");
3905
		IType type = workingCopies[0].getType("Test");
3906
		IMethod method = type.getMethods()[0];
3906
		IMethod method = type.getMethods()[0];
3907
		search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3907
		search(method, DECLARATIONS);
3908
		this.discard = false;
3908
		this.discard = false;
3909
		assertSearchResults(
3909
		assertSearchResults(
3910
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3910
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 3916-3922 Link Here
3916
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3916
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3917
		IType type = workingCopies[0].getType("Test");
3917
		IType type = workingCopies[0].getType("Test");
3918
		IMethod method = type.getMethods()[1];
3918
		IMethod method = type.getMethods()[1];
3919
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3919
		search(method, UI_DECLARATIONS);
3920
		this.discard = false;
3920
		this.discard = false;
3921
		assertSearchResults(
3921
		assertSearchResults(
3922
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
3922
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH"
Lines 3928-3934 Link Here
3928
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3928
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3929
		IType type = workingCopies[0].getType("Sub");
3929
		IType type = workingCopies[0].getType("Sub");
3930
		IMethod method = type.getMethods()[0];
3930
		IMethod method = type.getMethods()[0];
3931
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3931
		search(method, UI_DECLARATIONS);
3932
		this.discard = false;
3932
		this.discard = false;
3933
		assertSearchResults(
3933
		assertSearchResults(
3934
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3934
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 3940-3946 Link Here
3940
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3940
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3941
		IType type = workingCopies[0].getType("Sub");
3941
		IType type = workingCopies[0].getType("Sub");
3942
		IMethod method = type.getMethods()[1];
3942
		IMethod method = type.getMethods()[1];
3943
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3943
		search(method, UI_DECLARATIONS);
3944
		assertSearchResults(
3944
		assertSearchResults(
3945
			"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
3945
			"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
3946
		);
3946
		);
Lines 3965-3971 Link Here
3965
		);
3965
		);
3966
		IType type = workingCopies[0].getType("Test");
3966
		IType type = workingCopies[0].getType("Test");
3967
		IMethod method = type.getMethods()[0];
3967
		IMethod method = type.getMethods()[0];
3968
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3968
		search(method, UI_DECLARATIONS);
3969
		this.discard = false;
3969
		this.discard = false;
3970
		assertSearchResults(
3970
		assertSearchResults(
3971
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3971
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 3978-3984 Link Here
3978
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3978
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3979
		IType type = workingCopies[0].getType("Test");
3979
		IType type = workingCopies[0].getType("Test");
3980
		IMethod method = type.getMethods()[0];
3980
		IMethod method = type.getMethods()[0];
3981
		search(method, DECLARATIONS, SearchEngine.createHierarchyScope(type));
3981
		search(method, DECLARATIONS);
3982
		this.discard = false;
3982
		this.discard = false;
3983
		assertSearchResults(
3983
		assertSearchResults(
3984
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
3984
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
Lines 3991-3997 Link Here
3991
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3991
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
3992
		IType type = workingCopies[0].getType("Test");
3992
		IType type = workingCopies[0].getType("Test");
3993
		IMethod method = type.getMethods()[1];
3993
		IMethod method = type.getMethods()[1];
3994
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
3994
		search(method, UI_DECLARATIONS);
3995
		this.discard = false;
3995
		this.discard = false;
3996
		assertSearchResults(
3996
		assertSearchResults(
3997
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
3997
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
Lines 4038-4044 Link Here
4038
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4038
		assertEquals("Invalid number of working copies kept between tests!", 1, workingCopies.length);
4039
		IType type = workingCopies[0].getType("X");
4039
		IType type = workingCopies[0].getType("X");
4040
		IMethod method = type.getMethods()[1];
4040
		IMethod method = type.getMethods()[1];
4041
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4041
		search(method, UI_DECLARATIONS);
4042
		this.discard = false;
4042
		this.discard = false;
4043
		assertSearchResults(
4043
		assertSearchResults(
4044
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
4044
			"src/b100772/Test.java void b100772.Test.foo(Class) [foo] EXACT_MATCH\n" + 
Lines 4055-4060 Link Here
4055
			"src/b100772/Test.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4055
			"src/b100772/Test.java void b100772.X.foo(Exception) [foo] EXACT_MATCH"
4056
		);
4056
		);
4057
	}
4057
	}
4058
	public void testBug100772_MultipleClasses01() throws CoreException {
4059
		workingCopies = new ICompilationUnit[3];
4060
		workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/I.java",
4061
			"package b100772;\n" + 
4062
			"public interface I<T> {\n" + 
4063
			"	public void foo(T t);\n" + 
4064
			"}\n" + 
4065
			"interface J extends I<String> {\n" + 
4066
			"	public void foo(String s);\n" + 
4067
			"}\n" + 
4068
			"class K implements J {\n" + 
4069
			"	public void foo(String s) {}\n" + 
4070
			"	public void foo(Exception e) {}\n" + 
4071
			"}\n"
4072
		);
4073
		workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b100772/X.java",
4074
			"package b100772;\n" + 
4075
			"public class X<T> {\n" + 
4076
			"	public void foo(T t) {}\n" + 
4077
			"}\n" + 
4078
			"class Y extends X<String> {\n" + 
4079
			"	public void foo(String t) {}\n" + 
4080
			"	public void foo(Exception t) {}\n" + 
4081
			"}\n"
4082
		);
4083
		workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4084
			"package b100772;\n" + 
4085
			"public class Test<T> {\n" + 
4086
			"	public void foo(T t) {}\n" + 
4087
			"}\n" + 
4088
			"class Sub extends Test<String> {\n" + 
4089
			"	public void foo(String t) {}\n" + 
4090
			"	public void foo(Exception t) {}\n" + 
4091
			"}\n"
4092
		);
4093
		IType type = workingCopies[2].getType("Test");
4094
		IMethod method = type.getMethods()[0];
4095
		search(method, UI_DECLARATIONS);
4096
		this.discard = false;
4097
		assertSearchResults(
4098
			"src/b100772/I.java void b100772.I.foo(T) [foo] EXACT_MATCH\n" + 
4099
			"src/b100772/I.java void b100772.J.foo(String) [foo] EXACT_MATCH\n" + 
4100
			"src/b100772/I.java void b100772.K.foo(String) [foo] EXACT_MATCH\n" + 
4101
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4102
			"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4103
			"src/b100772/X.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
4104
			"src/b100772/X.java void b100772.Y.foo(String) [foo] EXACT_MATCH"
4105
		);
4106
	}
4107
	public void testBug100772_MultipleClasses02() throws CoreException {
4108
		assertNotNull("There should be working copies!", workingCopies);
4109
		assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4110
		IType type = workingCopies[2].getType("Test");
4111
		IMethod method = type.getMethods()[0];
4112
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4113
		this.discard = false;
4114
		assertSearchResults(
4115
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4116
			"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
4117
		);
4118
	}
4119
	public void testBug100772_MultipleClasses03() throws CoreException {
4120
		assertNotNull("There should be working copies!", workingCopies);
4121
		assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4122
		IType type = workingCopies[2].getType("Sub");
4123
		IMethod method = type.getMethods()[0];
4124
		search(method, UI_DECLARATIONS);
4125
		this.discard = false;
4126
		assertSearchResults(
4127
			"src/b100772/I.java void b100772.I.foo(T) [foo] EXACT_MATCH\n" + 
4128
			"src/b100772/I.java void b100772.J.foo(String) [foo] EXACT_MATCH\n" + 
4129
			"src/b100772/I.java void b100772.K.foo(String) [foo] EXACT_MATCH\n" + 
4130
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4131
			"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH\n" + 
4132
			"src/b100772/X.java void b100772.X.foo(T) [foo] EXACT_MATCH\n" + 
4133
			"src/b100772/X.java void b100772.Y.foo(String) [foo] EXACT_MATCH"
4134
		);
4135
	}
4136
	public void testBug100772_MultipleClasses04() throws CoreException {
4137
		assertNotNull("There should be working copies!", workingCopies);
4138
		assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4139
		IType type = workingCopies[2].getType("Sub");
4140
		IMethod method = type.getMethods()[0];
4141
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4142
		this.discard = false;
4143
		assertSearchResults(
4144
			"src/b100772/Test.java void b100772.Test.foo(T) [foo] EXACT_MATCH\n" + 
4145
			"src/b100772/Test.java void b100772.Sub.foo(String) [foo] EXACT_MATCH"
4146
		);
4147
	}
4148
	public void testBug100772_MultipleClasses05() throws CoreException {
4149
		assertNotNull("There should be working copies!", workingCopies);
4150
		assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4151
		IType type = workingCopies[2].getType("Sub");
4152
		IMethod method = type.getMethods()[1];
4153
		search(method, UI_DECLARATIONS);
4154
		this.discard = false;
4155
		assertSearchResults(
4156
			"src/b100772/I.java void b100772.K.foo(Exception) [foo] EXACT_MATCH\n" + 
4157
			"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH\n" + 
4158
			"src/b100772/X.java void b100772.Y.foo(Exception) [foo] EXACT_MATCH"
4159
		);
4160
	}
4161
	public void testBug100772_MultipleClasses06() throws CoreException {
4162
		assertNotNull("There should be working copies!", workingCopies);
4163
		assertEquals("Invalid number of working copies kept between tests!", 3, workingCopies.length);
4164
		IType type = workingCopies[2].getType("Sub");
4165
		IMethod method = type.getMethods()[1];
4166
		search(method, UI_DECLARATIONS, SearchEngine.createHierarchyScope(type));
4167
		this.discard = false;
4168
		assertSearchResults(
4169
			"src/b100772/Test.java void b100772.Sub.foo(Exception) [foo] EXACT_MATCH"
4170
		);
4171
	}
4058
	public void testBug100772_Complex01() throws CoreException {
4172
	public void testBug100772_Complex01() throws CoreException {
4059
		workingCopies = new ICompilationUnit[1];
4173
		workingCopies = new ICompilationUnit[1];
4060
		workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",
4174
		workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b100772/Test.java",

Return to bug 100772