Community
Participate
Working Groups
XtextResource#doSave() verifies that the resource only contains a single top-level object (i.e. getContents().size() == 1). At the same time the JvmModelXbaseLazyLinker will install additional top-level objects for any inferred objects. Should the check in XtextResource#doSave() be weakened or is a language such as Domainmodel required to subclass LazyLinkingResource if it needs to serialize a model using the standard EMF resource API? Domainmodel test case to reproduce the problem: public class Main { public static void main(String[] args) throws IOException { Injector injector = new DomainmodelStandaloneSetup().createInjectorAndDoEMFRegistration(); XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class); Resource resource = resourceSet.createResource(URI.createURI("foo.dmodel")); resource.load(new StringInputStream("entity Foo {}"), null); resource.save(null); } }
Reclassifying as enhancement. Although one could argue that it is a bug for languages like Xtend2 and Domainmodel, as it breaks the EMF resource API contract.
Xbaseified languages should use the XbaseResource. The precondition could be weakend there.
Sounds reasonable.
We've decided to make the mentioned behavior default, because the pattern we use in Xbase, to put derived EObjects into the resource's contents list after the root element, is generally useful. Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0