### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java,v retrieving revision 1.7 diff -u -r1.7 RecoveredTypeBinding.java --- dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java 24 Aug 2007 17:17:34 -0000 1.7 +++ dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java 7 Nov 2007 14:52:29 -0000 @@ -244,7 +244,11 @@ * @see org.eclipse.jdt.core.dom.ITypeBinding#getSuperclass() */ public ITypeBinding getSuperclass() { - return this.resolver.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ + ITypeBinding object = this.resolver.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ + if (this == object) { + return null; + } + return object; } /* (non-Javadoc) #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java,v retrieving revision 1.184 diff -u -r1.184 ASTConverterTest2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 24 Sep 2007 11:39:33 -0000 1.184 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 7 Nov 2007 14:52:37 -0000 @@ -5544,4 +5544,33 @@ } } + /** + * @bug 186410: [dom] StackOverflowError due to endless superclass bindings hierarchy + * @test Ensures that the superclass of "java.lang.Object" class is null even when it's a recovered binding + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=186410" + */ + public void test0610() throws CoreException, IOException { + try { + createJavaProject("P", new String[] {""}, new String[0], ""); + createFile("P/A.java", + "public class A {\n" + + " void method(){}\n" + + "}" + ); + createFile("P/B.java", + "public class B extends A {\n" + + " void method(){}\n" + + "}" + ); + ICompilationUnit cuA = getCompilationUnit("P/A.java"); + CompilationUnit unitA = (CompilationUnit) runConversion(AST.JLS3, cuA, true, false, true); + AbstractTypeDeclaration type = (AbstractTypeDeclaration)unitA.types().get(0); + ITypeBinding typeSuperclass = type.resolveBinding().getSuperclass(); + assertEquals("Unexpected superclass", "Object", typeSuperclass.getName()); + assertNull("java.lang.Object should not have any superclass", typeSuperclass.getSuperclass()); + } finally { + deleteProject("P"); + } + } + }