### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java,v retrieving revision 1.110 diff -u -r1.110 TypeHierarchy.java --- model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 6 Jul 2010 08:42:07 -0000 1.110 +++ model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 10 Nov 2010 07:45:37 -0000 @@ -197,6 +197,7 @@ * Adds the type to the collection of interfaces. */ protected void addInterface(IType type) { + if (this.interfaces.contains(type)) return; this.interfaces.add(type); } /** #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java,v retrieving revision 1.97 diff -u -r1.97 TypeHierarchyTests.java --- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 11 May 2010 18:58:15 -0000 1.97 +++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 10 Nov 2010 07:45:40 -0000 @@ -35,7 +35,7 @@ ITypeHierarchy typeHierarchy; static { -// TESTS_NAMES= new String[] { "testGeneric7" }; +// TESTS_NAMES= new String[] { "testBug329663a" }; } public static Test suite() { return buildModelTestSuite(TypeHierarchyTests.class); @@ -2421,4 +2421,84 @@ " [in testIt() [in BugTest2Buggy [in BugTest2Buggy.java [in p288698 [in src288698.classbug [in TypeHierarchy]]]]]]\n", hierarchy); } +public void testBug329663() throws JavaModelException, CoreException { + try { + IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], ""); + IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, ""); + createFolder("/P1/p"); + createFile( + "/P1/p/I.java", + "package p;\n" + + "public interface I{}"); + createFile( + "/P1/p/X.java", + "package p;\n" + + "public class X implements I{\n" + + "}" + ); + createFolder("/P2/q"); + createFile( + "/P2/q/Y.java", + "package q;\n" + + "import p.*;\n" + + "public class Y implements I {\n" + + "}" + ); + IRegion region = JavaCore.newRegion(); + region.add(p1); + region.add(p2); + ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null); + IType[] types = hierarchy.getRootInterfaces(); + assertTypesEqual("Unexpected super interfaces", + "java.io.Serializable\n" + + "p.I\n", + types); + } + finally{ + deleteProject("P1"); + deleteProject("P2"); + } +} +public void testBug329663a() throws JavaModelException, CoreException { + try { + IJavaProject p1 = createJavaProject("P1", new String[] {""}, new String[] {"JCL_LIB"}, new String[0], ""); + IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] {"/P1"}, ""); + createFolder("/P1/p"); + createFile( + "/P1/p/I.java", + "package p;\n" + + "public interface I{}"); + createFile( + "/P1/p/X.java", + "package p;\n" + + "public class X implements I{\n" + + "}" + ); + createFolder("/P2/q"); + createFile( + "/P2/q/I.java", + "package q;\n" + + "public interface I{}"); + createFile( + "/P2/q/Y.java", + "package q;\n" + + "public class Y implements I {\n" + + "}" + ); + IRegion region = JavaCore.newRegion(); + region.add(p1); + region.add(p2); + ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null); + IType[] types = hierarchy.getRootInterfaces(); + assertTypesEqual("Unexpected super interfaces", + "java.io.Serializable\n" + + "p.I\n" + + "q.I\n", + types); + } + finally{ + deleteProject("P1"); + deleteProject("P2"); + } } +} \ No newline at end of file