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

Collapse All | Expand All

(-)JavaSearchMultipleProjectsTests.java (-3 / +52 lines)
Lines 54-60 Link Here
54
			"/P2/Y.java",
54
			"/P2/Y.java",
55
			"import p.X;\n" +
55
			"import p.X;\n" +
56
			"public class Y extends X {\n" +
56
			"public class Y extends X {\n" +
57
			"	void foo() {\n" +
57
			"	protected void foo() {\n" +
58
			"	}\n" +
58
			"	}\n" +
59
			"}" 
59
			"}" 
60
		);
60
		);
Lines 102-115 Link Here
102
			"/P2/Y.java",
102
			"/P2/Y.java",
103
			"import p.X;\n" +
103
			"import p.X;\n" +
104
			"public class Y extends X {\n" +
104
			"public class Y extends X {\n" +
105
			"	void foo() {\n" +
105
			"	protected void foo() {\n" +
106
			"	}\n" +
106
			"	}\n" +
107
			"}" 
107
			"}" 
108
		);
108
		);
109
		createFile(
109
		createFile(
110
			"/P2/Z.java",
110
			"/P2/Z.java",
111
			"public class Z extends Y {\n" +
111
			"public class Z extends Y {\n" +
112
			"	void foo() {\n" +
112
			"	protected void foo() {\n" +
113
			"	}\n" +
113
			"	}\n" +
114
			"}" 
114
			"}" 
115
		);
115
		);
Lines 128-133 Link Here
128
			resultCollector);
128
			resultCollector);
129
		assertEquals(
129
		assertEquals(
130
			"p/X.java [in P1] p.X.bar() -> void [foo()]", 
130
			"p/X.java [in P1] p.X.bar() -> void [foo()]", 
131
			resultCollector.toString());
132
	} finally {
133
		deleteProject("P1");
134
		deleteProject("P2");
135
	}
136
}
137
/**
138
 * Search for references in a hierarchy should find matches in super type.
139
 * (regression test for bug 35755 Search in hierarchy misses dependent projects )
140
 */
141
public void testHierarchyScope3() throws CoreException {
142
	try {
143
		createJavaProject("P1");
144
		createFolder("/P1/p");
145
		createFile(
146
			"/P1/p/X.java",
147
			"package p;\n" +
148
			"public class X {\n" +
149
			"	protected void foo() {\n" +
150
			"	}\n" +
151
			"}" 
152
		);
153
		createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
154
		createFolder("/P2/q");
155
		createFile(
156
			"/P2/q/Y.java",
157
			"package q;\n" +
158
			"import p.X;\n" +
159
			"public class Y extends X {\n" +
160
			"	void bar() {\n" +
161
			"		foo();\n" +
162
			"	}\n" +
163
			"}" 
164
		);
165
166
		ICompilationUnit cu = getCompilationUnit("/P1/p/X.java");
167
		IType type = cu.getType("X");
168
		IMethod method = type.getMethod("foo", new String[] {});
169
		IJavaSearchScope scope = SearchEngine.createHierarchyScope(type);
170
		JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
171
		resultCollector.showProject = true;
172
		new SearchEngine().search(
173
			getWorkspace(), 
174
			method, 
175
			REFERENCES, 
176
			scope, 
177
			resultCollector);
178
		assertEquals(
179
			"q/Y.java [in P2] q.Y.bar() -> void [foo()]", 
131
			resultCollector.toString());
180
			resultCollector.toString());
132
	} finally {
181
	} finally {
133
		deleteProject("P1");
182
		deleteProject("P1");

Return to bug 35755