Bug 518248 - ClassCastException in PartServiceImpl.switchPerspective
Summary: ClassCastException in PartServiceImpl.switchPerspective
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-14 10:07 EDT by EPP Error Reports CLA
Modified: 2021-11-19 01:00 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description EPP Error Reports CLA 2017-06-14 10:07:38 EDT
The following problem was reported via the automated error reporting:

Message: Unhandled event loop exception
java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.basic.MPart
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.switchPerspective(PartServiceImpl.java:652)
    at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:102)
    at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:68)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:144)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:5434)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:212)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
    at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
    at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
    at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
    at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52)
    at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
    at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:135)
    at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
    at org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher$4.widgetSelected(PerspectiveSwitcher.java:543)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)



Bundles:
| org.eclipse.e4.ui.services | 1.3.0.v20170307-2032 | 1.3.0.v20170307-2032 |
| org.eclipse.e4.ui.workbench | 1.5.0.v20170412-0908 | 1.5.0.v20170412-0908 |
| org.eclipse.e4.ui.workbench.renderers.swt | 0.14.100.v20170508-1121 | 0.14.100.v20170508-1121 |
| org.eclipse.e4.ui.workbench.swt | 0.14.100.v20170427-2027 | 0.14.100.v20170427-2027 |
| org.eclipse.emf.common | 2.13.0.v20170503-0428 | 2.13.0.v20170503-0428 |
| org.eclipse.equinox.event | 1.4.0.v20170105-1446 | 1.4.0.v20170105-1446 |
| org.eclipse.osgi | 3.12.0.v20170512-1932 | 3.12.0.v20170512-1932 |
| org.eclipse.swt | 3.106.0.v20170518-0932 | 3.106.0.v20170518-0932 |
| org.eclipse.ui | 3.109.0.v20170411-1742 | 3.109.0.v20170411-1742 |

Operating Systems:
| Linux | 3.10.0.21 | 3.10.0.21 |


The above information is a snapshot of the collected data. Visit https://dev.eclipse.org/recommenders/committers/aeri/v2/#!/problems/5937316ce4b096dd38d81d6e for the latest data.

Thank you for your assistance.
 Your friendly error-reports-inbox.
Comment 1 Andrey Loskutov CLA 2021-03-08 09:06:46 EST
Similar stack from 4.15:

!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ClassCastException: class org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl cannot be cast to class org.eclipse.e4.ui.model.application.ui.basic.MPart (org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl and org.eclipse.e4.ui.model.application.ui.basic.MPart are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @22346157)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.switchPerspective(PartServiceImpl.java:655)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:102)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:78)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5799)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:152)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
	at org.eclipse.ui.internal.WorkbenchPage.busySetPerspective(WorkbenchPage.java:4000)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$10(WorkbenchPage.java:3972)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3972)
	at org.eclipse.ui.internal.Workbench.activate(Workbench.java:2915)
	at org.eclipse.ui.internal.Workbench.busyShowPerspective(Workbench.java:2956)
	at org.eclipse.ui.internal.Workbench.lambda$19(Workbench.java:2931)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2929)
	at org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2904)
	at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager.switchToPerspective(PerspectiveManager.java:386)
	at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$2.runInUIThread(PerspectiveManager.java:464)
	at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$MyUIJob.lambda$0(PerspectiveManager.java:232)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4930)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4451)
Comment 2 Andrey Loskutov CLA 2021-03-08 09:19:44 EST
Rolf, any idea what could cause this one? I'm not that experienced with e4, especially MPlaceholder and it's "special" meaning there.

This seem to be a regression from bug 388617.
Comment 3 Rolf Theunissen CLA 2021-03-08 09:33:33 EST
(In reply to Andrey Loskutov from comment #2)
> Rolf, any idea what could cause this one? I'm not that experienced with e4,
> especially MPlaceholder and it's "special" meaning there.
> 
> This seem to be a regression from bug 388617.

MPlaceholder is an element that references to a shared element, that is in practice a shared MPart or MArea. All views in the Eclipse IDE are inserted with MPlaceholders. In this case, it is incorrectly assumed that all elements in a stack are MParts. It should expect a mixture of MParts and MPlaceholders. Instead of the direct cast, there should be a check for MPlaceholder, and in that case its 'getRef' should be used as MPart to activate.
Comment 4 Eclipse Genie CLA 2021-03-08 09:44:43 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/177355
Comment 5 Eclipse Genie CLA 2021-03-08 14:00:58 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/177374
Comment 6 Niraj Modi CLA 2021-06-03 01:34:37 EDT
Moving out of 4.20, please re-target as required.
Comment 7 Kalyan Prasad Tatavarthi CLA 2021-08-27 07:35:55 EDT
Moving out of 4.21, please re-target as required.
Comment 8 Kalyan Prasad Tatavarthi CLA 2021-11-19 01:00:59 EST
Moving out of 4.22, please re-target as required.