Project: Eclipse_Platform_UI
Bug 363856 [DI] Erroneous field injection?
Reported: 2011-11-15 13:16:51 | Status: verified fixed

BuildId: I20111028-1100 OS: MacOS X (only because it demonstrates the problem) The CocoaUIProcessor requests the MApplication through injection. But an interesting thing occurs: when the MApplication instance is set (in E4Application#createE4Workbench()), the injector actually tries to inject with a created instance of MApplication, which fails. This can be seen if you place a breakpoint on InjectionException: Daemon Thread [Thread-1] (Suspended (exception InjectionException)) InjectorImpl.internalMake(Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 326 InjectorImpl.resolveArgs(Requestor, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean, boolean, boolean) line: 450 InjectorImpl.resolveArguments(IRequestor, boolean) line: 334 FieldRequestor(Requestor).resolveArguments(boolean) line: 115 ContextObjectSupplier$ContextInjectionListener.update(IEclipseContext, int, Object[]) line: 76 TrackableComputationExt.update(ContextChangeEvent) line: 106 EclipseContext.processScheduled(Set<Scheduled>) line: 307 EclipseContext.set(String, Object) line: 321 E4Application.createE4Workbench(IApplicationContext, Display) line: 231 (I often trap InjectionException as it seems the best way to discover why a handler isn't being invoked.)

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.java