Project: Eclipse_Platform_UI
Bug 370214 Throw Exception in @PostContruct leads to org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider"
Reported: 2012-01-31 08:19:33 | Status: verified fixed

If I throw an UnsupportedOperationException in @PostContruct I get the following error: org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": This is really bad as it makes it very hard to find the cause of the problem. Here is the example: @PostConstruct public void createControls(Composite parent) { Button button = new Button(parent, SWT.PUSH); button.setText("Delete Todo"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { throw new UnsupportedOperationException("not supported"); } }); } Here is the full stacktace: org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider". at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:387) at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:382) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:99) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:317) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:239) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153) at org.eclipse.e4.ui.internal.workbench.swt.StatusReporterCreationFunction.compute(StatusReporterCreationFunction.java:23) at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:59) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:220) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:229) at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:191) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9$1.eventLoopException(PartRenderingEngine.java:981) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.handle(PartRenderingEngine.java:1020) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1008) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:85) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:140) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579) at org.eclipse.equinox.launcher.Main.run(Main.java:1433) at org.eclipse.equinox.launcher.Main.main(Main.java:1409)

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchStatusReporter.java