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

Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java (-1 / +5 lines)
Lines 244-250 Link Here
244
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getSuperclass()
244
	 * @see org.eclipse.jdt.core.dom.ITypeBinding#getSuperclass()
245
	 */
245
	 */
246
	public ITypeBinding getSuperclass() {
246
	public ITypeBinding getSuperclass() {
247
		return this.resolver.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
247
		ITypeBinding object = this.resolver.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
248
		if (this == object) {
249
			return null;
250
		}
251
		return object;
248
	}
252
	}
249
253
250
	/* (non-Javadoc)
254
	/* (non-Javadoc)
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (+29 lines)
Lines 5544-5547 Link Here
5544
		}
5544
		}
5545
	}
5545
	}
5546
	
5546
	
5547
	/**
5548
	 * @bug 186410: [dom] StackOverflowError due to endless superclass bindings hierarchy
5549
	 * @test Ensures that the superclass of "java.lang.Object" class is null even when it's a recovered binding
5550
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=186410"
5551
	 */
5552
	public void test0610() throws CoreException, IOException {
5553
		try {
5554
			createJavaProject("P", new String[] {""}, new String[0], "");
5555
			createFile("P/A.java",
5556
				"public class A {\n" +
5557
				"	void method(){}\n" +
5558
				"}"
5559
			);
5560
			createFile("P/B.java",
5561
				"public class B extends A {\n" +
5562
				"	void method(){}\n" +
5563
				"}"
5564
			);
5565
			ICompilationUnit cuA = getCompilationUnit("P/A.java");
5566
			CompilationUnit unitA = (CompilationUnit) runConversion(AST.JLS3, cuA, true, false, true);
5567
			AbstractTypeDeclaration type = (AbstractTypeDeclaration)unitA.types().get(0);
5568
			ITypeBinding typeSuperclass = type.resolveBinding().getSuperclass();
5569
			assertEquals("Unexpected superclass", "Object", typeSuperclass.getName());
5570
			assertNull("java.lang.Object should  not have any superclass", typeSuperclass.getSuperclass());
5571
		} finally {
5572
			deleteProject("P");
5573
		}
5574
	}
5575
	
5547
}
5576
}

Return to bug 186410