私は Eclipse E4 RCP アプリケーションに取り組んでおり、依存性注入を使用しています。
ポストコンストラクトに実行時例外がある場合、コンソールにその例外が表示されないことに気付きました (飲み込まれていますか?)。そのクラスを注入できないという例外が表示されます。
たとえば、次のコードです。
@Creatable
@Singleton
public class OurClass {
@PostConstruct
public void postConstruct() {
System.out.println("PostConstruct Start");
throw new RuntimeException("Test");
}
}
public class OurPart {
@Inject
private OurClass ourClass;
}
次の出力が得られます。
PostConstruct Start
org.eclipse.e4.core.di.InjectionException: Unable to process "OurPart.ourClass": no actual value was found for the argument "OurClass".
at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:392)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:383)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:100)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.processHierarchy(E4Workbench.java:170)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.init(E4Workbench.java:118)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.<init>(E4Workbench.java:69)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:302)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:132)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:32)
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:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
PostConstruct Start
ランタイム例外も表示されるようにする方法を知っている人はいますか?