Bug 576555 - Type hierarchy empty
Summary: Type hierarchy empty
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.21   Edit
Hardware: PC Windows 10
: P3 normal with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2021-10-11 06:11 EDT by Al Bundy CLA
Modified: 2023-10-26 01:46 EDT (History)
8 users (show)

See Also:


Attachments
lag from start up to empty type hierarchy (137.74 KB, application/octet-stream)
2021-10-12 05:33 EDT, Al Bundy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Al Bundy CLA 2021-10-11 06:11:00 EDT
Since latest update (4.21) the type hierarchy is sometimes empty.

Usually I could select a class or interface and press ctrl+t or F4 and got all classes that are extending/implementing the class/interface.

But since last update the type hierarchy is sometimes empty but if I search all references in workspace (or with ctrl+shift+g) I find also classes that are implementing/extending the interface/class.

If I open such a class, select the interface (after the implementing keyword) and press ctrl+t the interface and the implementing class is shown.

If I open the editor of the interface and press ctrl+t the hierarchy is empty again.
Comment 1 Andrey Loskutov CLA 2021-10-11 06:24:16 EDT
Would be great to have minimal steps to reproduce. Any errors in the log? Is autobuild enabled? Any additional plugins that might interfere?
Comment 2 Al Bundy CLA 2021-10-11 08:18:41 EDT
No error in UI but some exceptions in .log

Stack Trace
	at java.base@11.0.9.1/java.io.FileDescriptor.close0(Native Method)
	at java.base@11.0.9.1/java.io.FileDescriptor.close(FileDescriptor.java:297)
	at java.base@11.0.9.1/java.io.RandomAccessFile$1.close(RandomAccessFile.java:653)
	at java.base@11.0.9.1/java.io.FileDescriptor.closeAll(FileDescriptor.java:355)
	at java.base@11.0.9.1/java.io.RandomAccessFile.close(RandomAccessFile.java:651)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.close(ZipFile.java:1287)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.release(ZipFile.java:1255)
	at java.base@11.0.9.1/java.util.zip.ZipFile$CleanableResource.run(ZipFile.java:807)
	at java.base@11.0.9.1/jdk.internal.ref.CleanerImpl$PhantomCleanableRef.performCleanup(CleanerImpl.java:186)
	at java.base@11.0.9.1/jdk.internal.ref.PhantomCleanable.clean(PhantomCleanable.java:133)
	at java.base@11.0.9.1/java.util.zip.ZipFile$CleanableResource.clean(ZipFile.java:731)
	at java.base@11.0.9.1/java.util.zip.ZipFile.close(ZipFile.java:887)
	at org.eclipse.jdt.internal.core.JavaModelManager.closeZipFile(JavaModelManager.java:1845)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren(JarPackageFragmentRoot.java:168)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.initializePackageNames(JavaProjectElementInfo.java:276)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.getProjectCache(JavaProjectElementInfo.java:244)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.newNameLookup(JavaProjectElementInfo.java:314)
	at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2870)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.<init>(SearchableEnvironment.java:103)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.<init>(SearchableEnvironment.java:133)
	at org.eclipse.jdt.internal.core.JavaProject.newSearchableNameEnvironment(JavaProject.java:2903)
	at org.eclipse.jdt.internal.core.JavaProject.newSearchableNameEnvironment(JavaProject.java:2900)
	at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:153)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:389)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:382)
	at org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:270)
	at org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:154)
	at org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:139)
	at org.eclipse.jdt.internal.ui.actions.SelectionConverter.getStructuredSelection(SelectionConverter.java:78)
	at org.eclipse.jdt.internal.ui.text.JavaElementProvider.getInformation2(JavaElementProvider.java:87)
	at org.eclipse.jface.text.information.InformationPresenter.computeInformation(InformationPresenter.java:310)
	at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:1101)
	at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:1091)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:175)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:205)
	at org.eclipse.ui.texteditor.TextOperationAction.lambda$0(TextOperationAction.java:130)
	at org.eclipse.ui.texteditor.TextOperationAction$$Lambda$936/0x0000000800f7e840.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:130)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at java.base@11.0.9.1/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@11.0.9.1/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base@11.0.9.1/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@11.0.9.1/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:580)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:647)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:439)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1270)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1059)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1084)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1069)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1111)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1107)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1536)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4875)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4753)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3624)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1041)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.ui.internal.Workbench$$Lambda$164/0x000000080038dc40.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base@11.0.9.1/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@11.0.9.1/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base@11.0.9.1/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@11.0.9.1/java.lang.reflect.Method.invoke(Method.java:566)
	at app//org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at app//org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at app//org.eclipse.equinox.launcher.Main.run(Main.java:1467)






!STACK 0
Stack Trace
	at java.base@11.0.9.1/java.io.RandomAccessFile.readBytes(Native Method)
	at java.base@11.0.9.1/java.io.RandomAccessFile.read(RandomAccessFile.java:406)
	at java.base@11.0.9.1/java.io.RandomAccessFile.readFully(RandomAccessFile.java:470)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.readFullyAt(ZipFile.java:1304)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1488)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1274)
	at java.base@11.0.9.1/java.util.zip.ZipFile$Source.get(ZipFile.java:1237)
	at java.base@11.0.9.1/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
	at java.base@11.0.9.1/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844)
	at java.base@11.0.9.1/java.util.zip.ZipFile.<init>(ZipFile.java:247)
	at java.base@11.0.9.1/java.util.zip.ZipFile.<init>(ZipFile.java:177)
	at java.base@11.0.9.1/java.util.zip.ZipFile.<init>(ZipFile.java:191)
	at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2896)
	at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2865)
	at org.eclipse.jdt.internal.core.util.Util.getJdkLevel(Util.java:888)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren(JarPackageFragmentRoot.java:125)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.initializePackageNames(JavaProjectElementInfo.java:276)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.getProjectCache(JavaProjectElementInfo.java:244)
	at org.eclipse.jdt.internal.core.JavaProject.getProjectCache(JavaProject.java:2450)
	at org.eclipse.jdt.internal.core.JavaProjectElementInfo.newNameLookup(JavaProjectElementInfo.java:333)
	at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2870)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.<init>(SearchableEnvironment.java:103)
	at org.eclipse.jdt.internal.core.JavaProject.newSearchableNameEnvironment(JavaProject.java:2892)
	at org.eclipse.jdt.internal.core.JavaProject.newSearchableNameEnvironment(JavaProject.java:2886)
	at org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.<init>(HierarchyBuilder.java:95)
	at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.<init>(IndexBasedHierarchyBuilder.java:136)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.compute(TypeHierarchy.java:320)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1319)
	at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:94)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:806)
	at org.eclipse.jdt.internal.core.SourceType.newTypeHierarchy(SourceType.java:950)
	at org.eclipse.jdt.internal.core.SourceType.newTypeHierarchy(SourceType.java:907)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.createTypeHierarchy(TypeHierarchyLifeCycle.java:295)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.doHierarchyRefresh(TypeHierarchyLifeCycle.java:325)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.doRestoreInBackground(TypeHierarchyViewPart.java:1684)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart$7.run(TypeHierarchyViewPart.java:1665)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Comment 3 Andrey Loskutov CLA 2021-10-11 09:48:30 EDT
(In reply to Al Bundy from comment #2)
> No error in UI but some exceptions in .log

Can you please attach *full* log file? This sounds like issues with the JRE used to run Eclipse.
Comment 4 Al Bundy CLA 2021-10-12 05:33:48 EDT
Created attachment 287302 [details]
lag from start up to empty type hierarchy
Comment 5 Andrey Loskutov CLA 2021-10-12 06:35:03 EDT
(In reply to Al Bundy from comment #4)
> Created attachment 287302 [details]
> lag from start up to empty type hierarchy

The errors in that part of the log file aren't directly related to the type hierarchy problem.

Can you provide *full* log please, not redacted in any way?
Comment 6 Andrey Loskutov CLA 2021-10-12 06:39:22 EDT
(In reply to Andrey Loskutov from comment #5)
> (In reply to Al Bundy from comment #4)
> > Created attachment 287302 [details]
> > lag from start up to empty type hierarchy
> 
> The errors in that part of the log file aren't directly related to the type
> hierarchy problem.
> 
> Can you provide *full* log please, not redacted in any way?

Better: start with a fresh new workspace please and try to reproduce the problem.
Once you have it, please attach the log file and ideally steps to reproduce.

Your current workspace shows a lot of broken dependencies, missing bundles etc. Not sure if that is somehow related to the problem you observe, but if you really want to solve your issues, please just throw away this workspace and start from scratch.
Comment 7 Al Bundy CLA 2021-10-22 06:21:01 EDT
I'll try this if I find the time to setup a fresh workspace.

Is there something to automate the setup of a workspace?
We already have a p2f-File with our plugins and some templates (formatter, templates, cleanup) but they have to be imported and configured manually.

Also compiler-settings etc. have to be done manually..

Maybe someone has a hint to make the whole process easier.
Comment 8 Duch Bechlegor CLA 2021-10-28 09:55:57 EDT
Hi, I have the same issue since upgrade to 4.21.

Just open any workspace which contains some Java projects, open some interface (which you know that has some implementations or extending interfaces) and choose "Quick type hierarchy" (Ctrl+T, ...).
Only parent interfaces are presented.

PS. The only error in workspace log file which I have (does not appear to be related to the problem):

!ENTRY org.eclipse.e4.ui.workbench 4 0 2021-10-28 15:51:59.678
!MESSAGE Unable to retrieve the bundle from the URI: bundleclass://com.genuitec.eclipse.meexplorer/com.genuitec.eclipse.meexplorer.breadcrumb.e4.BreadCrumbContainer
Comment 9 Al Bundy CLA 2021-11-01 04:02:00 EDT
last friday I've renewed my local installation
-> deleted eclipse, deleted workspace, deleted ~/.p2, deleted ~/.eclipse

it seems that the issue is now solved but I'll have an eye on it. :-)
Comment 10 Bjarke Skjernaa CLA 2021-11-04 05:59:58 EDT
I also had this issue in multiple workspaces. Closing and reopening all projects fixed it for me and it have not reappeared.
Comment 11 Ed Willink CLA 2021-12-02 01:48:57 EST
(In reply to Bjarke Skjernaa from comment #10)
> I also had this issue in multiple workspaces. Closing and reopening all
> projects fixed it for me and it have not reappeared.

Clearly the problem is a real problem experienced by multiple users. It has not been fixed. It is not invalid. It is just a pain to reproduce.

I just had similar problems with deficient sub-Type Hierrachy content. It remained deficient after a restart and close + clean all. (Specifically /org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/PropertyId.java showed a supertype but no subtypes.)

However it did not reproduce in another workspace.

Workaround: It was fixed by close then open project.

Clearly there is some kind of caching issue that survives a restart but not a reopen, and presumably some kind of error puts the cache in a bad state.
Comment 12 Matthew Turnbull CLA 2021-12-20 02:59:01 EST
I also encountered this issue after upgrading Eclipse from 4.20 to 4.21. Usually I install the new version side-by-side and create a new workspace. However, this time, I did an in-place upgrade and continued using the same workspace.

I found that removing .metadata/.plugins/org.eclipse.jdt.core corrected the issue. So it seems like something was preventing the indexes from being read or updated. The indexNamesMap.txt and savedIndexNames.txt mention INDEX VERSION 1.131 - though I don't know if that the same version Eclipse 4.10 used. Maybe there was a version migration and some data got corrupted?

The interesting thing is that it doesn't appear to generate any error messages in .metadata/.log when it's broken.

I still have the broken folder backed-up, but unfortunately I doubt I'd be able to share - it's from a work environment. But if there are things I can try/inspect, I'll do what I can.
Comment 13 Christian Sarrasin CLA 2021-12-30 11:57:27 EST
(In reply to Ed Willink from comment #11)
 
> Workaround: It was fixed by close then open project.
  ^^^^^^^^^^
Thank you so much for this!  Absolutely made my day.

I had the sane issue,, which manifested itself upon migrating my workspace from 4.20 to 4.21 (and persisted after migrating to 4.22).

I can confirm that closing and re-opening all projects in the workspace (in one go) appears to have fixed it permanently.

This made me realize just how critical this functionality is in navigating my code; I felt totally lost when it misbehaved.  I have inheritance relationships spanning multiple projects.
Comment 14 Yurx Cherio CLA 2022-01-07 17:34:49 EST
I confirm that closing/opening the projects brings both "Quick Type Hierarchy" and "Open Implementation" back to live. Without those features working the environment feels deficient and crippled.