Bug 24691

Summary: Missing interface makes hierarchy incomplete
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jerome Lanneluc CLA 2002-10-11 06:30:09 EDT
Build 20021009

1. Create the following cu:
public class X implements Missing {
}
2. Open hierarchy on X
Observe: The hierarchy is rooted at X. 

It should be rooted at java.lang.Object
Comment 1 Philipe Mulet CLA 2002-10-11 06:40:23 EDT
Ok to fix.
Comment 2 Jerome Lanneluc CLA 2002-10-11 06:52:05 EDT
Fixed HierarchyResolver.findSuperClass() to find the IGenericType of 
java.lang.Object if the source type's superclass is null.

Added regression test TypeHierarchyTests.testMissingInterface()
Comment 3 David Audel CLA 2002-10-16 10:46:46 EDT
I follow the step of the test case and "No Declaration of selected members in 
the chosen hierarchy of 'X'" appear in the Type Hierachy.
The correct hierarchy is printed in Supertype Hierarchy.

If you remove the 'implements Missing' in X.java there is an exception:
!ENTRY org.eclipse.jdt.core 4 4 Oct 16, 2002 17:00:25.437
!MESSAGE Exception occurred in listener of Java element change notification
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 0
	at org.eclipse.jdt.internal.core.TypeVector.add(TypeVector.java:41)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.getAllClasses
(TypeHierarchy.java:392)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.getAllTypes
(TypeHierarchy.java:501)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.hasTypeNamed
(TypeHierarchy.java:757)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.includesTypeOrSupertype
(TypeHierarchy.java:773)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByType
(TypeHierarchy.java:1072)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByOpenable
(TypeHierarchy.java:1012)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffected
(TypeHierarchy.java:836)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByChildren
(TypeHierarchy.java:849)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByPackageFragmen
t(TypeHierarchy.java:918)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffected
(TypeHierarchy.java:833)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByChildren
(TypeHierarchy.java:849)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByPackageFragmen
tRoot(TypeHierarchy.java:968)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffected
(TypeHierarchy.java:831)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByChildren
(TypeHierarchy.java:849)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByJavaProject
(TypeHierarchy.java:900)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffected
(TypeHierarchy.java:829)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByChildren
(TypeHierarchy.java:849)
	at 
org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffectedByJavaModel
(TypeHierarchy.java:865)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.isAffected
(TypeHierarchy.java:827)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.elementChanged
(TypeHierarchy.java:330)
	at org.eclipse.jdt.internal.core.JavaModelManager$3.run
(JavaModelManager.java:710)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:839)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.jdt.internal.core.JavaModelManager.fire
(JavaModelManager.java:705)
	at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged
(DeltaProcessor.java:1445)
	at org.eclipse.core.internal.events.NotificationManager$1.run
(NotificationManager.java:128)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:839)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.core.internal.events.NotificationManager.notify
(NotificationManager.java:143)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges
(NotificationManager.java:67)
	at org.eclipse.core.internal.resources.Workspace.broadcastChanges
(Workspace.java:133)
	at org.eclipse.core.internal.resources.Workspace.endOperation
(Workspace.java:753)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1383)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:78)
	at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation
(AbstractTextEditor.java:2578)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSaveOperatio
n(CompilationUnitEditor.java:703)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave
(CompilationUnitEditor.java:753)
	at org.eclipse.ui.internal.EditorManager$11.run(EditorManager.java:1011)
	at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:880)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:299)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249)
	at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:394)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
	at org.eclipse.jface.window.ApplicationWindow.run
(ApplicationWindow.java:391)
	at org.eclipse.ui.internal.WorkbenchWindow.run
(WorkbenchWindow.java:1119)
	at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation
(EditorManager.java:886)
	at org.eclipse.ui.internal.EditorManager.saveEditor
(EditorManager.java:1016)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor
(WorkbenchPage.java:2047)
	at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:749)
	at 
org.eclipse.ui.internal.registry.AcceleratorScope$AcceleratorAction.run
(AcceleratorScope.java:289)
	at org.eclipse.ui.internal.registry.AcceleratorScope.processKey
(AcceleratorScope.java:249)
	at org.eclipse.ui.internal.KeyBindingMenu$1.keyPressed
(KeyBindingMenu.java:54)
	at org.eclipse.ui.internal.KeyTable.handleEvent(KeyTable.java:75)
	at org.eclipse.ui.internal.KeyTable$3.handleEvent(KeyTable.java:116)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1360)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1343)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 4 Jerome Lanneluc CLA 2002-10-16 12:49:00 EDT
First problem was that the list of roots was empty (did not add 
java.lang.Object when there was a problem in the hierarchy).

Second problem was in the data structure TypeVector that resized its internal 
array to an empty one.

Fixed both cases.
Comment 5 David Audel CLA 2002-11-13 06:51:51 EST
Verified.