Bug 215681 - Type Hierarchy crashes in some cases of user input
Summary: Type Hierarchy crashes in some cases of user input
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-17 12:27 EST by Viacheslav Kabanovich CLA
Modified: 2008-02-04 16:18 EST (History)
0 users

See Also:


Attachments
Proposed fix and regression tests (5.08 KB, patch)
2008-01-22 06:39 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Viacheslav Kabanovich CLA 2008-01-17 12:27:18 EST
Build ID: M20070921-1145

Steps To Reproduce:
1. Create Java project.
2. Create two Java classes p.A and q.A (with the same name 'A' but in different packages 'p' and 'q').
3. Make class p.A a template by declaring it as
public class A<E> {...}
4. Make class q.A a subclass of p.A:
public class A extends p.A<Object> {...}
Make sure that everything is ok yet.
5. Make a deliberate error in code of class q.A 
by adding import:
import p.A;
and save the file.
Make sure that builder reports the problem 'The import p.A conflicts with a type defined in the same file', but system works without failures.
6. Make one more deliberate error by changing declaration of q.A as
public class A extends A<Object> {...}
(that is, as if we expect that the added import is going to work)
and save the file.
At this moment, system failure may or may not occur.
In my case the system still worked ok, and reported one more problem 'Cycle detected'.
7.In file q.A select declaration fragment 'A<Object>', invoke context menu by mouse right click and select 'Open Type Hierarchy' menu action.

System either hangs or shows error dialog reporting 'Stack overflow'. 
Stack trace shows cycling in class 
org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver

More information:
When system hangs, it is usually in method getDepth() in class 
org.eclipse.jdt.internal.ui.typehierarchy.TraditionalHierarchyViewer$TraditionalHierarchyContentProvider
infinitely repeating line 
superType= hierarchy.getSuperclass(superType)
in the body of 'while' operator.

When 'Stack overflow' is reported, it is usually cycling in class 
org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver

To reproduce the problem it is important to manipulate with two classes (rather than one trying to extend itself) and to make one of them template.
Comment 1 Jerome Lanneluc CLA 2008-01-22 06:39:19 EST
Created attachment 87505 [details]
Proposed fix and regression tests
Comment 2 Jerome Lanneluc CLA 2008-01-23 04:53:35 EST
Fix and test released for 3.4M5
Comment 3 Kent Johnson CLA 2008-02-04 16:18:03 EST
Verified for 3.4M5 using I20080204-0010