Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Loop over empty OrderedSet creates empty lines(Or: How to ask if something != null)
[Acceleo] Loop over empty OrderedSet creates empty lines [message #1810144] Thu, 01 August 2019 10:43 Go to next message
Marie-Saphira Flug is currently offline Marie-Saphira FlugFriend
Messages: 21
Registered: January 2019
Junior Member
I'm generating a .yaml file from an Xtext model and I have too many empty lines in it. In my template I print some properties that I get in an OrderedSet. During generation I get the following warning:
Invalid loop iteration at line 27 in Module generateDeployment for block for ( Last recorded value of self was null.
[for (aProperty : Property |]

'' is the OrderedSet, which is null sometimes. I'm pretty sure that this triggers the warning.
I would like to use "!= null" or "!oclIsUndefined" but I can't find a "not" operation anywhere.
I know that I can remove the empty lines in a post process, but I really don't want the warnings because the user will see them.

Thanks in advance,

so (something <> null) is working, I put it in front of every loop. Is there maybe a better way?

[Updated on: Thu, 01 August 2019 10:59]

Report message to a moderator

Re: [Acceleo] Loop over empty OrderedSet creates empty lines [message #1810155 is a reply to message #1810144] Thu, 01 August 2019 15:49 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7635
Registered: July 2009
Senior Member

There are surely many different ways. Which is 'better' would require analysis of more of your code. However using a not-null guard to protect against null usage is a pretty standard idiom in many languages, so I suspect most alternatives would just be obscure.


Ed Willink
Previous Topic:[acceleo] Standalone compiler (ant task)
Next Topic:[Acceleo] allInstances operator not available?
Goto Forum:

Current Time: Fri Dec 08 22:49:37 GMT 2023

Powered by FUDForum. Page generated in 0.01772 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top