### 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.74 diff -u -r1.74 HierarchyResolver.java --- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 6 Mar 2007 02:38:51 -0000 1.74 +++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 15 Nov 2007 09:29:45 -0000 @@ -657,16 +657,8 @@ } else { // cache binary type binding ClassFile classFile = (ClassFile)openable; - IBinaryType binaryType = null; - if (classFile.isOpen()) { - // create binary type from info - IType type = classFile.getType(); - try { - binaryType = (IBinaryType)((JavaElement)type).getElementInfo(); - } catch (JavaModelException e) { - // type exists since class file is opened - } - } else { + IBinaryType binaryType = (IBinaryType) JavaModelManager.getJavaModelManager().getInfo(classFile.getType()); + if (binaryType == null) { // create binary type from file if (classFile.getPackageFragmentRoot().isArchive()) { binaryType = this.builder.createInfoFromClassFileInJar(classFile); #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.73 diff -u -r1.73 TypeHierarchyTests.java --- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 27 Sep 2007 10:30:32 -0000 1.73 +++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 15 Nov 2007 09:29:47 -0000 @@ -1275,6 +1275,24 @@ assertTrue("Unexpected focus type for hierarchy on region", this.typeHierarchy.getType() == null); } /* + * Ensures that a call to IJavaProject.findType("java.lang.Object") doesn't cause the hierarchy + * computation to throw a StackOverFlow + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=209222) + */ +public void testFindObject() throws CoreException { + try { + IJavaProject p = createJavaProject("P"); + // ensure Object.class is closed + p.getPackageFragmentRoot(getExternalJCLPathString()).getPackageFragment("java.lang").getClassFile("Object.class").close(); + // find Object to fill internal jar type cache + IType type = p.findType("java.lang.Object"); + // create hierarchy + type.newTypeHierarchy(null); // should not throw a StackOverFlow + } finally { + deleteProject("P"); + } +} +/* * Ensures that a hierarchy on an type that implements a binary inner interface is correct. * (regression test for bug 58440 type hierarchy incomplete when implementing fully qualified interface) */