Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326537

Summary: ModelUtils.load ignores multi-rooted Ecore resources
Product: [Modeling] Acceleo Reporter: Ed Willink <ed>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: laurent.goubet
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ed Willink CLA 2010-09-29 09:43:14 EDT
The last few lines of ModelUtils.load select the first content of a multi-rooted Ecore resource.

Multi-rooted Ecore resources are valid, and MOFM2T inherently works on a forest since there may be multiple top level template matches. Why should these be constrained to come from the first root?

Surely the return from ModelUtils.load should either be a singleton Resource or a Collection of EObject roots?
Comment 1 Laurent Goubet CLA 2010-09-29 10:05:45 EDT
Ed,

The ModelUtils utility class was designed as such, and though we know full well that more than a single root can exist in a model (as mentionned in the javadoc of each of our ModelUtils#load() methods : <p>This will return the first root of the loaded model, other roots can be accessed via the resource's content.</p>), we return the first root for ease of use.

Most resources will only contain a single root we need to access (Acceleo's mtl files can only contain a single module, UML files often contain a single Model (though they do contain stereortype applications and the such...), etc). We make this assumption so as not to always iterate on every root, which can be extremely costly with UML.

However, if there _are_ actual locations in the code where we should go back up to the resource to check for other roots, then these are bugs. Please raise separate entries for them.