Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for faster UI bulk Operations #1614

Closed
jukzi opened this issue Nov 22, 2023 · 9 comments · Fixed by #1615
Closed

API for faster UI bulk Operations #1614

jukzi opened this issue Nov 22, 2023 · 9 comments · Fixed by #1615

Comments

@jukzi
Copy link
Contributor

jukzi commented Nov 22, 2023

Currently performing UI Operations like a "fast" type hierarchy can be kinda slow. By example for java.lang.Object.
Sampling i see most time is spend on opening binary JARs. Debugging that i see the same Zip files are opened again and again. JDT CORE already has an internal mechanism to prevent that: org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(Object) .
However there is no way to use that in jdt.ui. Example stacktrace:
image
The loop is in the UI and there is not CORE code around it - only jdt ui code.
As a proof of concept i added the internal cacheZipFiles() call around
org.eclipse.jdt.internal.ui.typehierarchy.HierarchyInformationControl.setInput(Object) and
org.eclipse.jdt.internal.core.SearchableEnvironment.SearchableEnvironment(JavaProject, ICompilationUnit[], boolean)
Which results in the time spend in org.eclipse.jdt.internal.core.JavaModelManager.getZipFile () is reduced from 48seconds to 40ms - more then thousand times faster! (SWT then becomes the bottle neck)
Any objection that JDT provides public API like org.eclipse.jdt.core.IJavaModel.runBatch(Runnable) ?
Other suggestions for the naming? @iloveeclipse @jjohnstn

@iloveeclipse
Copy link
Member

In general makes sense.

I would not add anything to IJavaModel for consistency with existing code in JavaCore.
Please take a look at:

  • org.eclipse.jdt.core.JavaCore.run(IWorkspaceRunnable, ISchedulingRule, IProgressMonitor)
  • org.eclipse.jdt.internal.core.BatchOperation.BatchOperation(IWorkspaceRunnable)

I assume you might want either update that run() above or (if that would be too dangerous/too complicated) add something like below

  • org.eclipse.jdt.core.JavaCore.run(ICoreRunnable, IProgressMonitor)

which has no need to have any "workspace" relationship.

@jukzi
Copy link
Contributor Author

jukzi commented Nov 22, 2023

@iloveeclipse thanks for feedback. The problem with JavaCore.run is that this does tons of other things because it is meant to be used for write operation. How about JavaCore.runRead(Runnable)?

@jukzi
Copy link
Contributor Author

jukzi commented Nov 22, 2023

or JavaCore.call(JavaCallable) like org.eclipse.swt.widgets.Display.syncCall(SwtCallable<T, E>)

@jukzi
Copy link
Contributor Author

jukzi commented Nov 22, 2023

the call hierarchy view is a bit more complicated: i don't see jdt.ui in the callstack around the sort:

java.lang.Exception: Warning: Zipfile was opened just 1ms ago in same thread Thread[main,6,main], consider caching: C:/Users/jkubitz/egit-2023-08-16/ws/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.osgi_3.18.400.v20230509-2241.jar
	at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2974)
	at org.eclipse.jdt.internal.core.nd.java.model.BinaryTypeFactory.rawReadTypeTestForExists(BinaryTypeFactory.java:144)
	at org.eclipse.jdt.internal.core.nd.java.model.BinaryTypeFactory.rawReadType(BinaryTypeFactory.java:120)
	at org.eclipse.jdt.internal.core.nd.java.model.BinaryTypeFactory.readType(BinaryTypeFactory.java:115)
	at org.eclipse.jdt.internal.core.ClassFile.getJarBinaryTypeInfo(ClassFile.java:246)
	at org.eclipse.jdt.internal.core.ClassFile.getBinaryTypeInfo(ClassFile.java:201)
	at org.eclipse.jdt.internal.core.ClassFile.buildStructure(ClassFile.java:92)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:266)
	at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:113)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:572)
	at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:288)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:289)
	at org.eclipse.jdt.internal.core.BinaryType.isAnonymous(BinaryType.java:737)
	at org.eclipse.jdt.internal.core.manipulation.JavaElementLabelComposerCore.appendTypeLabel(JavaElementLabelComposerCore.java:916)
	at org.eclipse.jdt.internal.core.manipulation.JavaElementLabelComposerCore.appendTypeLabel(JavaElementLabelComposerCore.java:890)
	at org.eclipse.jdt.internal.core.manipulation.JavaElementLabelComposerCore.appendTypeLabel(JavaElementLabelComposerCore.java:890)
	at org.eclipse.jdt.internal.core.manipulation.JavaElementLabelComposerCore.appendMethodLabel(JavaElementLabelComposerCore.java:458)
	at org.eclipse.jdt.internal.core.manipulation.JavaElementLabelComposerCore.appendElementLabel(JavaElementLabelComposerCore.java:174)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:532)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:505)
	at org.eclipse.jdt.ui.JavaElementLabels.getTextLabel(JavaElementLabels.java:409)
	at org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider.getText(JavaUILabelProvider.java:167)
	at org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyLabelProvider.getElementLabel(CallHierarchyLabelProvider.java:188)
	at org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyLabelProvider.getStyledText(CallHierarchyLabelProvider.java:106)
	at org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.getStyledText(DelegatingStyledCellLabelProvider.java:209)
	at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider.getStyledText(DecoratingStyledCellLabelProvider.java:197)
	at org.eclipse.jdt.internal.ui.viewsupport.ColoringLabelProvider.getText(ColoringLabelProvider.java:91)
	at org.eclipse.jface.viewers.ViewerComparator.getLabel(ViewerComparator.java:161)
	at org.eclipse.jface.viewers.ViewerComparator.compare(ViewerComparator.java:137)
	at org.eclipse.jface.viewers.ViewerComparator.lambda$0(ViewerComparator.java:206)
	at java.base/java.util.TimSort.binarySort(TimSort.java:296)
	at java.base/java.util.TimSort.sort(TimSort.java:239)
	at java.base/java.util.Arrays.sort(Arrays.java:1233)
	at org.eclipse.jface.viewers.ViewerComparator.sort(ViewerComparator.java:206)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalAdd(AbstractTreeViewer.java:290)
	at org.eclipse.jface.viewers.TreeViewer.internalAdd(TreeViewer.java:634)
	at org.eclipse.jface.viewers.AbstractTreeViewer.add(AbstractTreeViewer.java:171)
	at org.eclipse.ui.progress.DeferredTreeContentManager$3.runInUIThread(DeferredTreeContentManager.java:312)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)

@jukzi
Copy link
Contributor Author

jukzi commented Nov 22, 2023

the first time JDTs callstack is more usefull - CallHierarchyViewer could be overloaded:

java.util.Arrays.sort(T[], java.util.Comparator<? super T>) line: 1233	
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewPart$4(org.eclipse.jface.viewers.ViewerComparator).sort(org.eclipse.jface.viewers.Viewer, java.lang.Object[]) line: 206	
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewer(org.eclipse.jface.viewers.AbstractTreeViewer).internalAdd(org.eclipse.swt.widgets.Widget, java.lang.Object, java.lang.Object[]) line: 290	
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewer(org.eclipse.jface.viewers.TreeViewer).internalAdd(org.eclipse.swt.widgets.Widget, java.lang.Object, java.lang.Object[]) line: 634	
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewer(org.eclipse.jface.viewers.AbstractTreeViewer).add(java.lang.Object, java.lang.Object...) line: 171	
org.eclipse.ui.progress.DeferredTreeContentManager$3.runInUIThread(org.eclipse.core.runtime.IProgressMonitor) line: 312	

jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 22, 2023
…-jdt#1614

Also adds trace warnings when caching is missing.
And uses zip cache during some core actions that need it.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Nov 22, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 23, 2023
…-jdt#1614

Also adds trace warnings when caching is missing.
And uses zip cache during some core actions that need it.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 23, 2023
…-jdt#1614

Also adds trace warnings when caching is missing.
And uses zip cache during some core actions that need it.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Nov 23, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 24, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Nov 24, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
@HannesWell
Copy link
Contributor

Could this also help to speed up PDE's search for unused dependency (in the MANIFEST-Editor's dependency tab)?
I recently cleaned up quite a few plugins and since this was very slow I did a quick sampling and IIRC creating/reading some Java index (which also involved a lot of reading from the disk) took by far the most time.

@jukzi
Copy link
Contributor Author

jukzi commented Nov 27, 2023

Could this also help to speed up PDE's search for unused dependency (in the MANIFEST-Editor's dependency tab)?

May be, please try it out. It should be pretty simple to just add JavaCore.run() in the outermost PDE Class in the stacktrace of the problem

jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 27, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Nov 27, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 27, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 28, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 28, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 29, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Nov 30, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Nov 30, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
@jukzi jukzi linked a pull request Dec 4, 2023 that will close this issue
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Dec 4, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Dec 5, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Dec 5, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
jukzi pushed a commit that referenced this issue Dec 7, 2023
During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Dec 7, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Dec 8, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Dec 8, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to jukzi/eclipse.jdt.ui that referenced this issue Dec 11, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jukzi pushed a commit to eclipse-jdt/eclipse.jdt.ui that referenced this issue Dec 12, 2023
Improves performance of Call-Hierarchy, Type-Hierarchy, Hover, ...

eclipse-jdt/eclipse.jdt.core#1614
jarthana pushed a commit to jarthana/eclipse.jdt.core that referenced this issue Dec 13, 2023
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
noopur2507 pushed a commit that referenced this issue Dec 15, 2023
During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

#1614
@trancexpress
Copy link
Contributor

The first time I try to open a class with an F3, after I restart Eclipse, the editor cannot open due to this exception stack trace:

java.lang.IllegalStateException: Its not allow to modify JavaModel during ReadOnly action.
	at org.eclipse.jdt.internal.core.JavaModelManager.assertModelModifiable(JavaModelManager.java:5786)
	at org.eclipse.jdt.internal.core.DeltaProcessor.registerJavaModelDelta(DeltaProcessor.java:2037)
	at org.eclipse.jdt.internal.core.JavaModelOperation.addDelta(JavaModelOperation.java:176)
	at org.eclipse.jdt.internal.core.BecomeWorkingCopyOperation.executeOperation(BecomeWorkingCopyOperation.java:57)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:742)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:808)
	at org.eclipse.jdt.internal.core.CompilationUnit.becomeWorkingCopy(CompilationUnit.java:98)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createFileInfo(CompilationUnitDocumentProvider.java:1015)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java:481)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.connect(CompilationUnitDocumentProvider.java:1253)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4186)
	at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:262)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1474)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.internalDoSetInput(JavaEditor.java:2563)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:2536)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1415)
	at org.eclipse.ui.texteditor.AbstractTextEditor.lambda$1(AbstractTextEditor.java:3171)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:354)
	at org.eclipse.ui.internal.WorkbenchWindow.lambda$7(WorkbenchWindow.java:2335)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2332)
	at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3188)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3213)
	at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:353)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:344)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:976)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:938)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:138)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:385)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:311)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:203)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:992)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.createElement(PartServiceImpl.java:1314)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1275)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:394)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:283)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3182)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$11(WorkbenchPage.java:3118)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3116)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3086)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3077)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:380)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:184)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:289)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:183)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:280)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.lambda$0(SelectionDispatchAction.java:254)
	at org.eclipse.jdt.core.JavaCore.lambda$0(JavaCore.java:6032)
	at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5821)
	at org.eclipse.jdt.internal.core.JavaModelManager.callReadOnlyUnchecked(JavaModelManager.java:5809)
	at org.eclipse.jdt.internal.core.JavaModelManager.callReadOnly(JavaModelManager.java:5797)
	at org.eclipse.jdt.core.JavaCore.callReadOnly(JavaCore.java:6016)
	at org.eclipse.jdt.core.JavaCore.runReadOnly(JavaCore.java:6031)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:254)
	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:98)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:298)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:232)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:174)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:165)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:569)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:644)
	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:1953)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1528)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1555)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1538)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1577)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:937)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:4049)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:931)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2507)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:6883)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6162)
	at org.eclipse.swt.internal.gtk3.GTK3.gtk_main_do_event(Native Method)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1597)
	at org.eclipse.swt.internal.gtk3.GTK3.gtk_main_iteration_do(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4513)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1152)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1043)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:648)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:555)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	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:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1432)

I tried to open TestCaseElement from the body of org.eclipse.jdt.internal.junit.ui.TestViewer.getOpenTestAction(TestSuiteElement):

	private OpenTestAction getOpenTestAction(TestSuiteElement testSuite) {
		String testName= testSuite.getTestName();
		ITestElement[] children= testSuite.getChildren();

		if (children.length > 0 && children[0] instanceof TestCaseElement tce && tce.isDynamicTest()) {
			// a group of parameterized tests
			return new OpenTestAction(fTestRunnerPart, (TestCaseElement) children[0], null);
		}
I selected this one -> * TestCaseElement * child= testSuite.getSingleDynamicChild();
		if (child != null) {
			// a parameterized test that ran only one test
			return new OpenTestAction(fTestRunnerPart, child, null);
		}

		int index= testName.indexOf('(');
		// test factory method
		if (index > 0) {
			return new OpenTestAction(fTestRunnerPart, testSuite.getSuiteTypeName(), testName.substring(0, index), testSuite.getParameterTypes(), true);
		}

		// regular test class
		return new OpenTestAction(fTestRunnerPart, testName);
	}

The editor with TestViewer was already open prior to restarting, maybe that makes a difference - I don't know.

My Eclipse SDK is:

Eclipse SDK
Version: 2024-03 (4.31)
Build id: I20231212-1800

My workspace is very old, I have been re-using it for years now. I don't know if that makes a difference either.

@jukzi sorry I've not been follwing the JDT tracker. If there is an issue for this bug, sorry for the noise.

@jukzi
Copy link
Contributor Author

jukzi commented Dec 15, 2023

already fixed, please update

mpalat added a commit that referenced this issue Dec 19, 2023
* configure default output.. = bin/

* JavaSearchScope: improve encloses() performance  #474

* [test] remove outdated latestBREE project

* fix some ecj markers

Especially after moving files to compiler.batch - which has no resource
warnings - the @SuppressWarnings("resource") is not used - leading to a
marker

* Single async "Synchronizing projects" Job #419

Scheduling multiple times "while the job is running, the job will still
only be rescheduled once" (javadoc) so there will be always only a
single job running.
Using a Set prevents touching projects multiple times.

#419

Manually tested by changing Compiler Building options "Circular
dependencies", which triggers a new build.

* [test] fix AbstractJavaModelTests #1333

avoid asynchronous refresh. Implementation taken from
org.eclipse.core.tests.resources.refresh.RefreshProviderTest.joinAutoRefreshJobs()

#1333

* TestVerifier: never wait 100ms

improve test time, accurate timeout

* [performance] ClassFileReader: use already open Zip File

instead of creating new ZipFile instance.

also:
* use Files.readAllBytes
* removed unused code
* faster toUri avoiding isDirectory() check for the JARs which are known
to be no directory

improves performance of read() on windows by factor 2
tested with java reference search to java.lang.Object

* Stop skipping compare-with-baseline for jdt.annotation v2

One less thing that has to be manually tracked and done.

* Version bump for jdt.annotation

Pointed by
https://download.eclipse.org/eclipse/downloads/drops4/I20231130-0020/buildlogs/reporeports/reports/versionChecks.html

* Fix github urls in NOTICE file

* Use try-with-resource and enable warning if not

org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning

StringWriter does not need flush() or close() and can not throw
IOException.

Tests excluded.

To get rid of boiler plate code.

* version bumps

* [21] JEP 430 String Templates (#1513)

Grammar, compiler AST, resolution and code generation changes

* Javadoc: fix unclosed <code>

* break from loop within labeled block causes loss of nullness info (#1660)

fixes #1659

* Fixes incorrect Javadoc after StringBuffer to StringBuilder change

* NPE in ASTRewriteFlattener as return value of GuardedPattern.getPattern() is null  (#1647)

NPE in ASTRewriteFlattener as return value of
GuardedPattern.getPattern() is null

* Adding pomless build to JDT core

This enables pomless builds for JDT coreand removes the simple pom
files.

Future commits can reduce the usage of pom files further. This might
require enhancements in pomless builds to specify the test classes and
suites eclipse-tycho/tycho#3105

* Using Simplify lambda expression and method reference syntax cleanup on
core

Using the JDT UI "Simplify lambda expression and method reference
syntax" clean-up on jdt.core.

* Internal compiler error: ArrayIndexOutOfBoundsException in latest i build (#1664)


fixes #1661

* Using Simplify lambda expression and method reference syntax cleanup on
all plug-ins except core

Using the JDT UI "Simplify lambda expression and method reference
syntax" clean-up on all plug-ins except jdt.core.

* Using short-circuit in IncrementalImageBuilder

* Re-normalize line-endings in git of all files to Linux style ("\n")

Some files were checked-in into git having windows style line
endings (\r\n). This is in general not wanted because it can cause
modified files without any difference in git-staging on Windows if
auto-crlf is enabled.

To re-normalize line endings of all files use the following command
(including dot):

git add --renormalize .

* Bump bundle dependencies to trigger a rebuild / fix SDK build error

The change in bytecode of FullSourceWorkspaceBuildTests is due the
constant value change of
o.e.jdt.internal.compiler.parser.TerminalTokens.TokenNameEOF coming
from #1513.

Fixes eclipse-platform/eclipse.platform.releng.aggregator#1617

* False positive "Dead code" compiler error reported on org.eclipse.pde.internal.core.util.PDEJavaHelper.getExternalPackageFragment(String, String) (#1671)

fixes #1667

* Use diamond operator in jdt.core repo

Using the JDT UI clean-up, this removes the redundant type information.

Also activating
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
The rest of the changes in the prefs file were done by the tooling, not
by
selecting anther value.

* Improve constructor completions inside method invocations Fix #1587 (#1588)

* Try-with-resource clean-up in JDT core

Using the JDT UI try-with-resource clean-up on core.
Also manually inlining the declaration of multiple places into the try()
clause.

* Make inner classes static where possible in JDT core

Running the JDT performnace clean-up "Make inner classes static where
possible" in JDT core

* Use Use lazy logical operator (&& and ||)

Running the performance clean-up "Use lazy logical operator (&& and ||)"
on JDT core

* Using Integer.toString directly in Disassembler

It is also a JDT UI performance clean-up but this clean-up found only
one occurrence.

* use Path.of() to avoid 'Potential resource leak' warnings

* @NonNullByDefault does not work for type arguments of a local type (#1694)

fixes #1693

* ClassCastException during code completion on Annotation (#1696)

fixes #1440

Also fixes noise from #1662

* CompilationUnitResolver: Name the CU that causes Exception (#1690)

for example during Cleanup
eclipse-jdt/eclipse.jdt.ui#950

Co-authored-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>

* Code selection support for String template expressions (#1699)

Fixes  #1685

* Report error if string template is used without preview option enabled (#1697)

Improves the fix for #544

* ECJ crashes when an embedded expression contains broken code (#1702)

Set haltOnSyntaxError when parsing for embedded expressions. Also using the correct delimiters for text blocks in printExpression() methods.

* Selection model tests for string templates (#1704)

* tests: enable discouragedReference=warning, declare x-friends

to get rid of warnings during build (does not respect the jdt
preferences)

* Javadoc format fixes

Contributes to
eclipse-platform/eclipse.platform.releng.aggregator#1531

* Performance: Add public API for Batch Reads in UI - closes #1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

#1614

* Javadoc format fixes (part 2)

Contributes to
eclipse-platform/eclipse.platform.releng.aggregator#1531.
It's a pity that this takes multiple cycles but fixing one thing from
the log uncovers the next.

* ECJ 3.36.0 regression: The type 'E extends java.lang.Exception' is not a valid substitute for the type parameter 'E extends java.lang.@nonnull Exception' (#1708)

fixes #1691

+ also slightly updates NullAnnotationTests18 as NullAnnotationTests21

* Implement support for code completion inside embedded expression of (only) string templates (not text block templates) (#1712)

* Implement support for code completion inside embedded expression of
(only) string templates (not text block templates)

* Fixes #1711

* Fixes #1641 (#1713)

* Add new testcase #1701 (#1705)

* Content assist does not propose overrides in records (#1718)

* Fixes #1095

* JavaModelManager: lazy initialize TouchJob #1720

#1720

* Run the JavaCoreStandaloneTest in the build

#1720

* Bogus error about return expression involving pattern matching (#1731)

Fixes #1726

* Compiler fails to recognize an exhaustive switch (#1733)

*  Fixes #1725

* [21] Processed string templates falsely contain backslash characters (#1730)

#1719

* 1641_enum_further_fixes (#1739)

* Fix one too many pops arising from string concat invoke dynamic (#1740)

* Fix one too many pops arising from string concat invoke dynamic

* Fixes #1394

* Wrong placement of exception range closure results in AIOOB (#1744)

Fixes #1686

* Improper warning - Potential null pointer access (#1469)

Fixes #1461
Sets the flow info reach mode to FlowInfo.UNREACHABLE_BY_NULLANALYSIS
after 'Object o = null;if (Objects.isNull(o)) return;', 'Object o = "";if (Objects.nonNull(o)) return;

Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>

* Touch bundles affected by the changed ecj version

See #1394
See eclipse-platform/eclipse.platform.releng.aggregator#1659

* Upload eventfile and unit test results

* 2023-06->2023-09 Seems to have broke dependency graph management in our project (#1698)

* Add test for reproducing #1654
* Fix to make that test pass

---------

Co-authored-by: Stephan Herrmann <stephan.herrmann@berlin.de>

* [memory] SoftReference for ResourceCompilationUnit.contents #1743

Ability to reduce memory during searches that find many files

#1743

* deduplicate "eclipse" #1743

CharDeduplication was not designed to deduplicate tokens with length 7+
which could lead to high memory consumption. With this change tokens of
all sizes can be deduplicated.

#1743

A benchmark implemented in CharDeduplicationTest.main(String[]) shows
the new deduplication is performed at similar speed (.21s instead of
.16s) but deduplicates much more tokens (99% instead of 36%).

* 1703.constant definitions (#1756)

* Fixes [21] AIOOB at switchStatement TNode.addPattern  (#1757)

org.eclipse.jdt.internal.compiler.ast.SwitchStatement $TNode.addPattern

---------

Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
Co-authored-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>
Co-authored-by: Eric Milles <eric.milles@thomsonreuters.com>
Co-authored-by: Александър Куртаков <akurtakov@gmail.com>
Co-authored-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Co-authored-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Co-authored-by: Lars Vogel <Lars.Vogel@vogella.com>
Co-authored-by: Suby S Surendran <suby.surendran@ibm.com>
Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Co-authored-by: Andrey Loskutov <loskutov@gmx.de>
Co-authored-by: Gayan Perera <gayanper@gmail.com>
Co-authored-by: Jörg Kubitz <51790620+jukzi@users.noreply.github.com>
Co-authored-by: Srikanth Sankaran <131454720+srikanth-sankaran@users.noreply.github.com>
Co-authored-by: Ed Merks <ed.merks@gmail.com>
Co-authored-by: Snjeza <snjezana.peco@redhat.com>
Co-authored-by: Christoph Läubrich <laeubi@laeubi-soft.de>
Co-authored-by: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
rgrunber pushed a commit to eclipse-jdtls/eclipse-jdt-core-incubator that referenced this issue Jan 9, 2024
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
…t#1614

During Batches:
* cache Zip Files
* enable JavaModelManager.temporaryCache

Also:
* uses Batch Reads during some core actions that benefit from it.
* adds trace logging when caching is missing.

eclipse-jdt#1614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants