|
|
|
|
|
|
|
|
|
|
Re: [Xtext] NPE in ResourceDescriptionsProvider.createResourceDescriptions() after update to 2.9 / 2 [message #1736298 is a reply to message #1736260] |
Tue, 28 June 2016 06:15  |
Eclipse User |
|
|
|
Christian Dietrich wrote on Tue, 28 June 2016 03:24I am not sure what your child injector intends but why not Module.overrides(...)
The parent injector provides the configuration subsystem needed for newing a module which is used to initialize the child injector.
Ok, I dropped the idea of reusing an already initialized configuration in a child injector and refactored the injector setup as follows:
public class SculptorGeneratorSetup extends SculptordslStandaloneSetup {
@Override
public Injector createInjector() {
ConfigurationProvider configurationProvider = Guice.createInjector(new ConfigurationProviderModule()).getInstance(ConfigurationProvider.class);
try {
return Guice.createInjector(new ConfigurationProviderModule(), new SculptordslRuntimeModule(),
new ChainOverrideAwareModule(configurationProvider, DslTransformation.class, Transformation.class,
Class.forName("org.sculptor.generator.template.RootTmpl")));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Emergency - 'RootTmpl' not available on classpath");
}
}
}
Now the configuration subsystem is instantiated twice. But without using a child injector the binding of Xtext 2.9+ works 
Next I reintroduced the child injector as follows:
public class SculptorGeneratorSetup extends SculptordslStandaloneSetup {
@Override
public Injector createInjector() {
ConfigurationProvider configurationProvider = Guice.createInjector(new ConfigurationProviderModule()).getInstance(ConfigurationProvider.class);
try {
return Guice.createInjector().createChildInjector(new ConfigurationProviderModule(), new SculptordslRuntimeModule(),
new ChainOverrideAwareModule(configurationProvider, DslTransformation.class, Transformation.class,
Class.forName("org.sculptor.generator.template.RootTmpl")));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Emergency - 'RootTmpl' not available on classpath");
}
}
}
Now the NPE due to unbound IResourceDescriptions is back again
So it seems that the inner workings of Xtext 2.9+ have been changed with regards to Guice interceptor handling. Maybe Xtext is internally using interceptor injection now.
I'll check this with Xtext 2.8.
/Torsten
|
|
|
Powered by
FUDForum. Page generated in 0.08859 seconds