[Acceleo] For loop generate extra white line iterating on Set<Association> [message #1807722] |
Thu, 06 June 2019 12:17  |
Eclipse User |
|
|
|
Hi,
i have a really strange problem on my generated code. If i use the following function directly in mtl file with [file] tag i have no problem while if i use it in a template and i call it in [file] mtl i get this strange behavior.
Acceleo add a white line on each code line. I have tried with separator, trim but nothing changed.
Can you please help me?
Function:
[template public genChildGetterSetter(aClass : Class)]
[for(a : Association | aClass.getChildAssociations())]
/**
* @return the [aClass.getChildClass(a).name.toUpperFirst()/]
*/
public Collection<[aClass.getChildClass(a).name/]> get[aClass.getTheChildPropertyName(a).toUpperFirst()/](){
return [aClass.getTheChildPropertyName(a)/];
}
[/for]
[/template]
GetChildAssociations():
[query public getChildAssociations(arg0 : Class) : Set(Association)
= invoke('it.mice.acceleogenerator.javaservice.AssociationJavaUtils', 'getChildAssociations(org.eclipse.uml2.uml.Class)', Sequence{arg0})
/]
Result:
/**
* @return the ProdottoPerOrdine
*/
public Collection<ProdottoPerOrdine> getTheProdottoPerOrdine(){
return theProdottoPerOrdine;
}
Expected:
/**
* @return the ProdottoPerOrdine
*/
public Collection<ProdottoPerOrdine> getTheProdottoPerOrdine(){
return theProdottoPerOrdine;
}
|
|
|
|
|
Re: [Acceleo] For loop generate extra white line iterating on Set<Association> [message #1807813 is a reply to message #1807808] |
Mon, 10 June 2019 05:32  |
Eclipse User |
|
|
|
Hi
IMHO, anything that makes a tool unduly painful to use is an ergonomic bug, so yes it is at least an ergonomic bug.
The Acceleo documentation has extensive descriptions on when whitespace is generated, so you might be able to pin down which description is inconsistent with its implementation. If this identifies a simple bug it might be fixed; Acceleo is being maintained but not actively developed.
More realistically, you might abandon attempts to contort your Acceleo source code layout to get the whitespace right and instead generate many gratuitous new lines and then put the output through a very simple blank line filter. Where you really want a blank line you could arrange to mark it so that your blank filter converts it to a clean blank line.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.03829 seconds