### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java,v retrieving revision 1.78 diff -u -r1.78 HierarchyResolver.java --- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 9 Jan 2008 14:49:26 -0000 1.78 +++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 22 Jan 2008 15:20:08 -0000 @@ -547,13 +547,21 @@ for (int i = startIndex; i <= this.typeIndex; i++) { IGenericType igType = this.typeModels[i]; if (igType != null && igType.isBinaryType()) { + CompilationUnitDeclaration previousUnitBeingCompleted = this.lookupEnvironment.unitBeingCompleted; // fault in its hierarchy... try { + // ensure that unitBeingCompleted is set so that we don't get an AbortCompilation for a missing type + // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213249 ) + if (previousUnitBeingCompleted == null) { + this.lookupEnvironment.unitBeingCompleted = FakeUnit; + } ReferenceBinding typeBinding = this.typeBindings[i]; typeBinding.superclass(); typeBinding.superInterfaces(); } catch (AbortCompilation e) { // classpath problem for this type: ignore + } finally { + this.lookupEnvironment.unitBeingCompleted = previousUnitBeingCompleted; } } } #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.79 diff -u -r1.79 TypeHierarchyTests.java --- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 9 Jan 2008 14:49:31 -0000 1.79 +++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 22 Jan 2008 15:20:10 -0000 @@ -1511,7 +1511,7 @@ * is correct. * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213249 ) */ -public void testMissingBinarySuperclass() throws Exception { +public void testMissingBinarySuperclass1() throws Exception { try { IJavaProject project = createJavaProject("P", new String[0], "bin"); addClassFolder(project, "lib", new String[] { @@ -1541,6 +1541,41 @@ deleteProject("P"); } } +/* + * Ensures that a hierarchy on a binary type that extends a missing class with only binary types in the project + * is correct. + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213249 ) + */ +public void testMissingBinarySuperclass2() throws Exception { + try { + IJavaProject project = createJavaProject("P", new String[0], "bin"); + addClassFolder(project, "lib", new String[] { + "p/X213249.java", + "package p;\n" + + "public class X213249 {\n" + + "}", + "p/Y213249.java", + "package p;\n" + + "public class Y213249 extends X213249 {\n" + + "}", + "p/Z213249.java", + "package p;\n" + + "public class Z213249 extends Y213249 {\n" + + "}", + }, "1.4"); + deleteFile("/P/lib/p/X213249.class"); + IType type = getClassFile("/P/lib/p/Z213249.class").getType(); + ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null); + assertHierarchyEquals( + "Focus: Z213249 [in Z213249.class [in p [in lib [in P]]]]\n" + + "Super types:\n" + + " Y213249 [in Y213249.class [in p [in lib [in P]]]]\n" + + "Sub types:\n", + hierarchy); + } finally { + deleteProject("P"); + } +} /** * Ensures that a potential subtype that is not in the classpth is handle correctly. * (Regression test for PR #1G4GL9R)