Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312561 - Xpand cannot access structural features of EEnumLiteral for ecore metamodel inputs
Summary: Xpand cannot access structural features of EEnumLiteral for ecore metamodel i...
Status: CLOSED WONTFIX
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-12 05:41 EDT by Dennis Hendriks CLA
Modified: 2020-04-30 13:55 EDT (History)
2 users (show)

See Also:


Attachments
The example Xpand template to illustrate the problem. (570 bytes, text/plain)
2010-05-12 05:41 EDT, Dennis Hendriks CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Hendriks CLA 2010-05-12 05:41:05 EDT
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.
Comment 1 Dennis Hendriks CLA 2010-05-12 05:41:48 EDT
Created attachment 168105 [details]
The example Xpand template to illustrate the problem.
Comment 2 Karsten Thoms CLA 2020-04-30 13:55:07 EDT
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.