Community
Participate
Working Groups
Build Identifier: Build id: 20100218-1602 (Galileo SR2) For Xpand templates that have as input instances of the ecore metamodel, (that is, they have an Ecore as input), the structural features of EEnumLiterals cannot be accessed. For instance, using the Xpand template from the attachement (test.xpt), executing the workflow gives: [code] 844 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component of type org.eclipse.xpand2.Generator: EvaluationException : Couldn't find property 'name' for type cif::ActionDirections template::test.xpt[514,8] on line 24 'lit.name' template::test.xpt[392,35] on line 18 'EXPAND expELiterals FOR (EEnum)this' template::test.xpt[201,61] on line 12 'EXPAND expEClassifier FOREACH eClassifiers.sortBy(c|c.name)' template::test.xpt[111,27] on line 7 'EXPAND expEPackage FOR this' [23,37] on line 1 'EXPAND template::test::main FOR model' 846 ERROR WorkflowRunner - Workflow interrupted. Reason: Couldn't find property 'name' for type cif::ActionDirections (...) [/code] Statically everything is OK, but at runtime the errors pop up. The input model is cif.ecore, which contains an enumeration called 'ActionDirections', but the problem shows up for any ecore with an enumeration in it. For some reason variable 'lit' seems to be the enumeration type defined in cif.ecore instead of an instance of EEnumLiteral, or at least that's what the printed representation indicates. «EEnumLiteral.isInstance(lit)» evaluates to true, so 'lit' does seem to be an EEnumLiteral, but structural features like 'name', 'literal', 'instance', 'eAnnotations', etc cannot be accessed. About the only thing that can be done, is to call toString() on it... Reproducible: Always Steps to Reproduce: 1. Put the attachment (test.xpt) in an Xpand project. 2. Create a workflow which calls test.xpt for any Ecore with an enumeration defined in it. 3. Observe the errors.
Created attachment 168105 [details] The example Xpand template to illustrate the problem.
This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it.