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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java (-6 / +42 lines)
Lines 10-24 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.model;
11
package org.eclipse.jdt.core.tests.model;
12
12
13
import java.io.IOException;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
15
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.Path;
17
import org.eclipse.core.runtime.Path;
17
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.IClasspathEntry;
19
import org.eclipse.jdt.core.IJavaProject;
20
import org.eclipse.jdt.core.IPackageFragment;
21
import org.eclipse.jdt.core.JavaCore;
22
import org.eclipse.jdt.internal.core.IJavaElementRequestor;
19
import org.eclipse.jdt.internal.core.IJavaElementRequestor;
23
import org.eclipse.jdt.internal.core.JavaProject;
20
import org.eclipse.jdt.internal.core.JavaProject;
24
import org.eclipse.jdt.internal.core.NameLookup;
21
import org.eclipse.jdt.internal.core.NameLookup;
Lines 35-43 Link Here
35
	super(name);
32
	super(name);
36
}
33
}
37
34
35
	// Use this static initializer to specify subset for tests
36
	// All specified tests which do not belong to the class are skipped...
37
	static {
38
//		org.eclipse.jdt.internal.core.search.matching.MatchLocator.PRINT_BUFFER = false;
39
//		TESTS_PREFIX =  "testArray";
40
//		TESTS_NAMES = new String[] { "testFindBinaryTypeWithDollarName" };
41
//		TESTS_NUMBERS = new int[] { 8 };
42
//		TESTS_RANGE = new int[] { 6, -1 };
43
	}
44
38
public static Test suite() {
45
public static Test suite() {
39
	return new Suite(NameLookupTests2.class);
46
	return buildTestSuite(NameLookupTests2.class);
40
}
47
}
48
41
private NameLookup getNameLookup(JavaProject project) throws JavaModelException {
49
private NameLookup getNameLookup(JavaProject project) throws JavaModelException {
42
	return project.newNameLookup((WorkingCopyOwner)null);
50
	return project.newNameLookup((WorkingCopyOwner)null);
43
}
51
}
Lines 191-197 Link Here
191
 * Ensure that finding a package fragment with a working copy opened returns one element only
199
 * Ensure that finding a package fragment with a working copy opened returns one element only
192
 * (regression test for bug 89624 Open on selection proposes twice the same entry)
200
 * (regression test for bug 89624 Open on selection proposes twice the same entry)
193
 */
201
 */
194
public void testFingPackageFragementWithWorkingCopy() throws CoreException {
202
public void testFindPackageFragementWithWorkingCopy() throws CoreException {
195
	this.workingCopies = new ICompilationUnit[1];
203
	this.workingCopies = new ICompilationUnit[1];
196
	try {
204
	try {
197
		JavaProject project = (JavaProject)createJavaProject("P");
205
		JavaProject project = (JavaProject)createJavaProject("P");
Lines 213-218 Link Here
213
	}
221
	}
214
}
222
}
215
/*
223
/*
224
 * Ensure that a member type with a name ending with a dollar and a number is found
225
 * (regression test for bug 103466 Stack Overflow: Requesting Java AST from selection)
226
 */
227
public void testFindBinaryTypeWithDollarName() throws CoreException, IOException {
228
	try {
229
		IJavaProject project = createJavaProject("P");
230
		addLibrary(project, "lib.jar", "libsrc.zip", 
231
			new String[] {
232
				"p/X.java",
233
				"package p;\n" +
234
				"public class X {\n" +
235
				"  public class $1 {\n" +
236
				"    public class $2 {\n" +
237
				"    }\n" +
238
				"  }\n" +
239
				"}"
240
			}, 
241
			"1.4");
242
		IType type = getNameLookup((JavaProject) project).findType("p.X$$1", false, NameLookup.ACCEPT_ALL);
243
		assertTypesEqual(
244
			"Unexpected type", 
245
			"p.X$$1\n",
246
			new IType[] {type});
247
	} finally {
248
		deleteProject("P");
249
	}
250
}
251
/*
216
 * Performance test for looking up package fragments
252
 * Performance test for looking up package fragments
217
 * (see bug 72683 Slow code assist in Display view)
253
 * (see bug 72683 Slow code assist in Display view)
218
 */
254
 */

Return to bug 103466