Bug 121734

Summary: Cycle in class hierarchy causes infinite loop in Decoration Calculation
Product: [Eclipse Project] JDT Reporter: Adam Lally <alally>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.1.1   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Adam Lally CLA 2005-12-21 10:18:43 EST
Create the following two .java files, then try to open Bar.java in the Java editor.  The "Decoration Calculation" system task goes into an infinite loop, consuming the CPU and forcing you to kill the process.

Foo.java
--------
public class Foo extends Bar{
}

Bar.java
--------
public class Bar extends Foo {
	abstract Foo getFoo();
}
Comment 1 Olivier Thomann CLA 2005-12-21 10:21:41 EST
Moving to JDT/UI
Comment 2 Tobias Widmer CLA 2005-12-21 12:38:49 EST
Markus, can you have a look?
Comment 3 Markus Keller CLA 2006-01-03 07:01:13 EST
I cannot reproduce in 3.1.1. Do you have other plugins (not from the eclipse sdk) installed which provide more label decorators? Can you provide steps to reproduce in a clean eclipse install?
Comment 4 Markus Keller CLA 2006-01-03 07:05:54 EST
Oops, sorry. I can reproduce now.
Comment 5 Markus Keller CLA 2006-01-03 08:31:56 EST
Moving to JDT/Core. We call IType#newSupertypeHierarchy(IProgressMonitor) on Bar. The infinite cycle occurs in the first loop here:

ClassScope.checkForInheritedMemberTypes(SourceTypeBinding) line: 662
ClassScope.connectTypeHierarchy() line: 955
CompilationUnitScope.connectTypeHierarchy() line: 266
LookupEnvironment.completeTypeBindings(CompilationUnitDeclaration, boolean) line: 251
HierarchyResolver.resolve(Openable[], HashSet, IProgressMonitor) line: 642
HierarchyResolver.resolve(IGenericType) line: 477
IndexBasedHierarchyBuilder(HierarchyBuilder).buildSupertypes() line: 113
IndexBasedHierarchyBuilder.build(boolean) line: 132
TypeHierarchy.compute() line: 320
TypeHierarchy.refresh(IProgressMonitor) line: 1255
CreateTypeHierarchyOperation.executeOperation() line: 90
CreateTypeHierarchyOperation(JavaModelOperation).run(IProgressMonitor) line: 720
CreateTypeHierarchyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 779
SourceType.newSupertypeHierarchy(WorkingCopyOwner, IProgressMonitor) line: 701
SourceType.newSupertypeHierarchy(IProgressMonitor) line: 653
SuperTypeHierarchyCache.getTypeHierarchy(IType, IProgressMonitor) line: 120
SuperTypeHierarchyCache.getTypeHierarchy(IType) line: 80
SuperTypeHierarchyCache.getMethodOverrideTester(IType) line: 89
OverrideIndicatorLabelDecorator.getOverrideIndicators(IMethod) line: 162
OverrideIndicatorLabelDecorator.computeAdornmentFlags(Object) line: 129
OverrideIndicatorLabelDecorator.decorate(Object, IDecoration) line: 261
LightweightDecoratorDefinition.decorate(Object, IDecoration) line: 249
LightweightDecoratorManager$LightweightRunnable.run() line: 66
SafeRunner.run(ISafeRunnable) line: 37
Platform.run(ISafeRunnable) line: 785
LightweightDecoratorManager.decorate(Object, DecorationBuilder, LightweightDecoratorDefinition) line: 323
LightweightDecoratorManager.getDecorations(Object, DecorationBuilder) line: 309
DecorationScheduler$1.run(IProgressMonitor) line: 292
Worker.run() line: 58
Comment 6 Philipe Mulet CLA 2006-04-10 11:33:59 EDT
+1 for 3.2RC1
Comment 7 Kent Johnson CLA 2006-04-10 15:01:33 EDT
Added TypeHierarchyTests testCycle()
Comment 8 David Audel CLA 2006-04-14 05:03:45 EDT
Verified for 3.2RC1 with build I20060413-1718