| Summary: | [Xpand] ONFILECLOSE works only for the first file | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] M2T | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> | ||||
| Component: | Xpand | Assignee: | Karsten Thoms <karsten.thoms> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | darius.jockel, karsten.thoms, m2t.xpand-inbox, sven.efftinge | ||||
| Version: | 1.0.0 | Flags: | sven.efftinge:
helios+
|
||||
| Target Milestone: | SR1 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 168512 [details] Sample Project as described in comment#1 In ExpandStatement it was remembered that the statement should be evaluated deferred by setting the flag 'deferredToFileClose'. This flag needed to be resetted in any case, since the same ExpandStatement instance will be used by later evaluations. Fixed in ExpandStatement 1.14 Has this been fixed, Karsten? Bug is fixed |
1) Create a the examplary EMF-based Xpand Project 2) Modify Template.xpt to this: «IMPORT metamodel» «EXTENSION template::GeneratorExtensions» «DEFINE main FOR Model» «EXPAND javaClass FOREACH entities()» «ENDDEFINE» «DEFINE javaClass FOR Entity» «FILE name+".java"» public class «name» { «EXPAND fieldDef FOREACH properties(this) ONFILECLOSE» «FOREACH features AS f» «properties(this).add(f).isEmpty?"":""-» public void «f.setter()»(«f.type.name» «f.name») { this.«f.name» = «f.name»; } public «f.type.name» «f.getter()»() { return «f.name»; } «ENDFOREACH» } «ENDFILE» «ENDDEFINE» «DEFINE fieldDef FOR Feature» private «type.name» «name»; «ENDDEFINE» 3) Modify the GeneratorExtensions.ext to import metamodel; extension metamodel::Extensions reexport; getter(Feature this) : "get"+name.toFirstUpper(); setter(Feature this) : "set"+name.toFirstUpper(); cached List[Feature] properties(Entity this): {}; 4) Run the workflow and note the compile errors in Address.java 5) Change the definition in the template to «DEFINE main FOR Model» «EXPAND javaClass FOREACH entities().reverse()» «ENDDEFINE» 6) Run the workflow and note the compile errors in Person.java