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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java (-1 / +2 lines)
Lines 167-173 Link Here
167
				break;
167
				break;
168
			case TypeDeclaration.INTERFACE_DECL :
168
			case TypeDeclaration.INTERFACE_DECL :
169
			case TypeDeclaration.ANNOTATION_TYPE_DECL :
169
			case TypeDeclaration.ANNOTATION_TYPE_DECL :
170
				this.hierarchy.addInterface(typeHandle);
170
				if (this.hierarchy.typeToSuperInterfaces.get(typeHandle) == null)
171
					this.hierarchy.addInterface(typeHandle);
171
				break;
172
				break;
172
		}
173
		}
173
		if (superinterfaceHandles == null) {
174
		if (superinterfaceHandles == null) {
(-)src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java (+97 lines)
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
/**
2425
 * @bug  329663:[type hierarchy] Interfaces duplicated in type hierarchy on two packages from multiple projects
2426
 * @test that when two selected regions contains the same interface, it's not reported twice in the hierarchy.
2427
 * 
2428
 * @throws JavaModelException
2429
 * @throws CoreException
2430
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=329663"
2431
 */
2432
public void testBug329663() throws JavaModelException, CoreException {
2433
	try {
2434
		IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], "");
2435
		IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
2436
		createFolder("/P1/p");
2437
		createFile(
2438
				"/P1/p/I.java",
2439
				"package p;\n" +
2440
				"public interface I{}");
2441
		createFile(
2442
				"/P1/p/X.java",
2443
				"package p;\n" +
2444
				"public class X implements I{\n" +
2445
				"}"
2446
		);
2447
		createFolder("/P2/q");
2448
		createFile(
2449
				"/P2/q/Y.java",
2450
				"package q;\n" +
2451
				"import p.*;\n" +
2452
				"public class Y implements I {\n" +
2453
					"}"
2454
		);
2455
		IRegion region = JavaCore.newRegion();
2456
		region.add(p1);
2457
		region.add(p2);
2458
		ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
2459
		IType[] types = hierarchy.getRootInterfaces();
2460
		assertTypesEqual("Unexpected super interfaces", 
2461
				"java.io.Serializable\n" + 
2462
				"p.I\n", 
2463
				types);
2464
	}
2465
	finally{
2466
		deleteProject("P1");
2467
		deleteProject("P2");
2468
	}
2469
}
2470
/**
2471
 * @bug  329663:[type hierarchy] Interfaces duplicated in type hierarchy on two packages from multiple projects
2472
 * @test that when two selected regions contains interfaces with same name but different, they are reported individually
2473
 * in the hierarchy.
2474
 * 
2475
 * @throws JavaModelException
2476
 * @throws CoreException
2477
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=329663"
2478
 */
2479
public void testBug329663a() throws JavaModelException, CoreException {
2480
try {
2481
	IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], "");
2482
	IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, "");
2483
	createFolder("/P1/p");
2484
	createFile(
2485
			"/P1/p/I.java",
2486
			"package p;\n" +
2487
			"public interface I{}");
2488
	createFile(
2489
			"/P1/p/X.java",
2490
			"package p;\n" +
2491
			"public class X implements I{\n" +
2492
				"}"
2493
	);
2494
	createFolder("/P2/q");
2495
	createFile(
2496
			"/P2/q/I.java",
2497
			"package q;\n" +
2498
			"public interface I{}");
2499
	createFile(
2500
			"/P2/q/Y.java",
2501
			"package q;\n" +
2502
			"public class Y implements I {\n" +
2503
				"}"
2504
	);
2505
	IRegion region = JavaCore.newRegion();
2506
	region.add(p1);
2507
	region.add(p2);
2508
	ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
2509
	IType[] types = hierarchy.getRootInterfaces();
2510
	assertTypesEqual("Unexpected super interfaces", 
2511
			"java.io.Serializable\n" + 
2512
			"p.I\n" + 
2513
			"q.I\n", 
2514
			types);
2515
}
2516
finally{
2517
	deleteProject("P1");
2518
	deleteProject("P2");
2519
}
2520
}
2424
}
2521
}

Return to bug 329663