[Acceleo] Unexpected inheritance behavior [message #641792] |
Sun, 28 November 2010 05:56 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Glenview Jeff![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=junk%40theaxelrods.com) Messages: 79 Registered: September 2010 |
Member |
|
|
I was able to successfully use the inheritance mechanism initially, but have run into some unexpected behavior.
If I try to create a template that looks like this, everything works as expected.
[module a extends b]
[template public ItemActivity(i : ItemActivity) overrides Activity]
[file ('/src/abc/'.concat(i.name.concat('.java')), false, 'Cp1252')]
[doOtherTemplateStuff(i)/]
[/file]
[/template]
[template public doOtherTemplateStuff(i : ItemActivity) overrides doOtherTemplateStuff]
[super/]
xyzzy1
[/template]
[/module]
[module b]
[template public Activity(a : Activity)]
[doOtherTemplateStuff(a)/]
[/template]
[template public doOtherTemplateStuff(a : Activity)]
[super/]
xyzzy2
[/template]
[/module]
If on the other hand I do this (changing [doOtherTemplateStuff(i)/] to [super/]:
[module a]
[template public ItemActivity(i : ItemActivity) overrides Activity]
[file ('/src/abc/'.concat(i.name.concat('.java')), false, 'Cp1252')]
[super/]
[/file]
[/template]
[template public doOtherTemplateStuff(i : ItemActivity) overrides doOtherTemplateStuff]
[super/]
xyzzy1
[/template]
[/module]
[module b]
[template public Activity(a : Activity)]
[doOtherTemplateStuff(a)/]
[/template]
[/module]
[template public doOtherTemplateStuff(a : Activity)]
xyzzy2
[/template]
[/module]
then I get no output. What am I missing?
Thanks!
Jeff
[Updated on: Mon, 29 November 2010 19:11] Report message to a moderator
|
|
|
Re: [Acceleo] Unexpected inheritance behavior [message #641906 is a reply to message #641792] |
Mon, 29 November 2010 08:36 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Jeff,
To override a template, you have to have : your module "extends" another module and your template "overrides" another template ... your examples mix these in randomly, I believe these problems are typos but :
- your "module b" has a template that overrides another even though the module itself doesn't extend any module.
- your second "module a" doesn't have an extends clause even though its templates try and overrides template from b.
That being said, I don't know what a "super" call nested in a file block would do. If you do have the "extends" and "overrides" clauses right, then we most likely have a bug with this "super" nesting. Could you rise a bug in such a case?
Laurent Goubet
Obeo
|
|
|
|
Re: [Acceleo] Unexpected inheritance behavior [message #642169 is a reply to message #642093] |
Tue, 30 November 2010 08:27 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
This is a multi-part message in MIME format.
--------------050806010707060003020506
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Jeff,
I must admit the calls to "super" aren't something that have been
thoroughly tested. I cannot test ATM and do not remember exactly the
code behind these ... thus my requesting that you file a bug :p.
There is a possibility the problem lies in the arguments passed to
"super"... but I'll have to check the code before answering for sure.
Laurent Goubet
Obeo
On 29/11/2010 20:07, glenviewjeff wrote:
> Thanks as always for the prompt response. I apologize for the hastily
> typed example; I did make a typo and will edit it for future readers.
> It's module a that extends module b, and module b's template shouldn't
> have an overrides statement.
> I will file a bug for this. I would think this is a common use case, or
> am I missing something? How else would you capture common behavior that
> spans multiple files/paths?
>
> I had been suspecting that the problem was that I wasn't able to pass
> the "i" ItemActivity parameter in the super call that is expecting
> Activity. (ItemActivity specializes Activity if this wasn't already
> obvious.) Is the parameter implicitly passed anyhow?
> Thanks,
> Jeff
--------------050806010707060003020506
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------050806010707060003020506--
|
|
|
Powered by
FUDForum. Page generated in 0.03184 seconds