Community
Participate
Working Groups
The allContentsFromModel method uses the getResources method to find all resources from which elements should be retrieved. The reason for this is so that the expand flag is respected -> comments suggest we are looking for parent resources of the current EMF model. However, the selection logic is flawed because the { rootContainer == null } condition is not enough. When using an InMemoryEmfModel there might be multiple resources loaded into the resource set, and for unrelated resources the rootContainer will also be null. As a result, methods that depend on getAllContents/allContentsFromModel are returning elements that are not contained in the model (nor its container). Antonio, according to git you are the author of this particular section. Can you tell us more about the logic and how we could improve it?
Given this is marked as a "blocker" (is this really that critical?), we should ideally fix this before next release. The lack of attention this has received suggests it is not a "blocker".
I realised Antonio was not CC'd, hence no reply.
This is done to support models that use cross-file containment. A single "model" may be split across many .xmi files, which means we have to find the "root" resources inside that resource set. I am not sure how we would distinguish the cross-file containment case from the "unrelated models in the same set" case. Perhaps InMemoryEmfModel should be tweaked to support the idea of a "main" resource, or have its allContentsFromModel() method appropriately changed.
I guess another valid solution would be to improve the documentation/ui information on allContentsFromModel method. Most of this "bugs" come from using Epsilon in standalone applications, where the ResourceSet is under control of the user and not Eclipse/EMF. That is, if some one warns me that A.all() will go over the complete ResourceSet then I could be "smarter" and use separate ResourceSets for un-related models or when I want to limit the reach of the the all() semantics.
+1 for doing it through documentation. Particularly, I'd suggest tweaking any articles we may have about this in the website, and also extending the InMemoryEmfModel talking about this resource set issue.