Closed schwerdf closed 3 months ago
Does it work if you use this code?
public class AADLXtextParser {
private XtextResourceSet resourceSet;
private void setupParser() {
Aadl2StandaloneSetup setup = new Aadl2StandaloneSetup();
Injector injector = setup.createInjector();
injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
}
}
Not verbatim, but it does work if I explicitly assign the return value from getInstance
to the field:
public class AADLXtextParser {
private XtextResourceSet resourceSet;
private void setupParser() {
Aadl2StandaloneSetup setup = new Aadl2StandaloneSetup();
Injector injector = setup.createInjector();
resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
}
}
Oops, missed the assignment, but you got the idea. This shows that the issue is actually the processing of the annotation, so it has nothing to do with OSATE.
I am using the
Aadl2StandaloneSetup
API to invoke the AADL parser outside of an editor window, as follows:In OSATE versions up to and including 2.13, the injector will populate the
resourceSet
field with the workspace's resource set. In 2.14, it does nothing, causing aNullPointerException
on the call toaddLoadOption
.