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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java (-10 / +2 lines)
Lines 657-672 Link Here
657
			} else {
657
			} else {
658
				// cache binary type binding
658
				// cache binary type binding
659
				ClassFile classFile = (ClassFile)openable;
659
				ClassFile classFile = (ClassFile)openable;
660
				IBinaryType binaryType = null;
660
				IBinaryType binaryType = (IBinaryType) JavaModelManager.getJavaModelManager().getInfo(classFile.getType());
661
				if (classFile.isOpen()) {
661
				if (binaryType == null) {
662
					// create binary type from info
663
					IType type = classFile.getType();
664
					try {
665
						binaryType = (IBinaryType)((JavaElement)type).getElementInfo();
666
					} catch (JavaModelException e) {
667
						// type exists since class file is opened
668
					}
669
				} else {
670
					// create binary type from file
662
					// create binary type from file
671
					if (classFile.getPackageFragmentRoot().isArchive()) {
663
					if (classFile.getPackageFragmentRoot().isArchive()) {
672
						binaryType = this.builder.createInfoFromClassFileInJar(classFile);
664
						binaryType = this.builder.createInfoFromClassFileInJar(classFile);
(-)src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java (+18 lines)
Lines 1275-1280 Link Here
1275
	assertTrue("Unexpected focus type for hierarchy on region", this.typeHierarchy.getType() == null);
1275
	assertTrue("Unexpected focus type for hierarchy on region", this.typeHierarchy.getType() == null);
1276
}
1276
}
1277
/*
1277
/*
1278
 * Ensures that a call to IJavaProject.findType("java.lang.Object") doesn't cause the hierarchy
1279
 * computation to throw a StackOverFlow
1280
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=209222)
1281
 */
1282
public void testFindObject() throws CoreException {
1283
	try {
1284
		IJavaProject p = createJavaProject("P");
1285
		// ensure Object.class is closed
1286
		p.getPackageFragmentRoot(getExternalJCLPathString()).getPackageFragment("java.lang").getClassFile("Object.class").close();
1287
		// find Object to fill internal jar type cache
1288
		IType type = p.findType("java.lang.Object");
1289
		// create hierarchy
1290
		type.newTypeHierarchy(null); // should not throw a StackOverFlow
1291
	} finally {
1292
		deleteProject("P");
1293
	}
1294
}
1295
/*
1278
 * Ensures that a hierarchy on an type that implements a binary inner interface is correct.
1296
 * Ensures that a hierarchy on an type that implements a binary inner interface is correct.
1279
 * (regression test for bug 58440 type hierarchy incomplete when implementing fully qualified interface)
1297
 * (regression test for bug 58440 type hierarchy incomplete when implementing fully qualified interface)
1280
 */
1298
 */

Return to bug 209222