| [Acceleo] Unexpected inheritance behavior [message #641792] | 
Sun, 28 November 2010 00:56   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 14:11] by Moderator  
 |  
 |  
  | 
 | 
 | 
| Re: [Acceleo] Unexpected inheritance behavior [message #642169 is a reply to message #642093] | 
Tue, 30 November 2010 03:27   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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.24369 seconds