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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java (+1 lines)
Lines 197-202 Link Here
197
 * Adds the type to the collection of interfaces.
197
 * Adds the type to the collection of interfaces.
198
 */
198
 */
199
protected void addInterface(IType type) {
199
protected void addInterface(IType type) {
200
	if (this.interfaces.contains(type)) return;
200
	this.interfaces.add(type);
201
	this.interfaces.add(type);
201
}
202
}
202
/**
203
/**
(-)src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java (-1 / +81 lines)
Lines 35-41 Link Here
35
	ITypeHierarchy typeHierarchy;
35
	ITypeHierarchy typeHierarchy;
36
36
37
static {
37
static {
38
//	TESTS_NAMES= new String[] { "testGeneric7" };
38
//	TESTS_NAMES= new String[] { "testBug329663a" };
39
}
39
}
40
public static Test suite() {
40
public static Test suite() {
41
	return buildModelTestSuite(TypeHierarchyTests.class);
41
	return buildModelTestSuite(TypeHierarchyTests.class);
Lines 2421-2424 Link Here
2421
		"  <anonymous #1> [in testIt() [in BugTest2Buggy [in BugTest2Buggy.java [in p288698 [in src288698.classbug [in TypeHierarchy]]]]]]\n",
2421
		"  <anonymous #1> [in testIt() [in BugTest2Buggy [in BugTest2Buggy.java [in p288698 [in src288698.classbug [in TypeHierarchy]]]]]]\n",
2422
		hierarchy);
2422
		hierarchy);
2423
}
2423
}
2424
public void testBug329663() throws JavaModelException, CoreException {
2425
		try {
2426
			IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], "");
2427
			IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
2428
			createFolder("/P1/p");
2429
			createFile(
2430
					"/P1/p/I.java",
2431
					"package p;\n" +
2432
					"public interface I{}");
2433
			createFile(
2434
					"/P1/p/X.java",
2435
					"package p;\n" +
2436
					"public class X implements I{\n" +
2437
					"}"
2438
			);
2439
			createFolder("/P2/q");
2440
			createFile(
2441
					"/P2/q/Y.java",
2442
					"package q;\n" +
2443
					"import p.*;\n" +
2444
					"public class Y implements I {\n" +
2445
						"}"
2446
			);
2447
			IRegion region = JavaCore.newRegion();
2448
			region.add(p1);
2449
			region.add(p2);
2450
			ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
2451
			IType[] types = hierarchy.getRootInterfaces();
2452
			assertTypesEqual("Unexpected super interfaces", 
2453
					"java.io.Serializable\n" + 
2454
					"p.I\n", 
2455
					types);
2456
		}
2457
		finally{
2458
			deleteProject("P1");
2459
			deleteProject("P2");
2460
		}
2461
}
2462
public void testBug329663a() throws JavaModelException, CoreException {
2463
	try {
2464
		IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], "");
2465
		IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
2466
		createFolder("/P1/p");
2467
		createFile(
2468
				"/P1/p/I.java",
2469
				"package p;\n" +
2470
				"public interface I{}");
2471
		createFile(
2472
				"/P1/p/X.java",
2473
				"package p;\n" +
2474
				"public class X implements I{\n" +
2475
					"}"
2476
		);
2477
		createFolder("/P2/q");
2478
		createFile(
2479
				"/P2/q/I.java",
2480
				"package q;\n" +
2481
				"public interface I{}");
2482
		createFile(
2483
				"/P2/q/Y.java",
2484
				"package q;\n" +
2485
				"public class Y implements I {\n" +
2486
					"}"
2487
		);
2488
		IRegion region = JavaCore.newRegion();
2489
		region.add(p1);
2490
		region.add(p2);
2491
		ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
2492
		IType[] types = hierarchy.getRootInterfaces();
2493
		assertTypesEqual("Unexpected super interfaces", 
2494
				"java.io.Serializable\n" + 
2495
				"p.I\n" + 
2496
				"q.I\n", 
2497
				types);
2498
	}
2499
	finally{
2500
		deleteProject("P1");
2501
		deleteProject("P2");
2502
	}
2424
}
2503
}
2504
}

Return to bug 329663