Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Null references in Xtext when we do a clean build(Null references in Xtext when we do a clean build)
icon14.gif  Null references in Xtext when we do a clean build [message #1281652] Tue, 01 April 2014 06:38 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi all,
I have 2 xtext grammars with language extensions .model1 and .model2. I have used the concept of cross references i.e. some of the elements of .model1 are referenced in .model2.

So, now I have 2 editors for .model1 and .model2. When I edit and save .model2 editor I get all the cross referenced values properly in the generators. But when I clean build a project these references are null resulting in wrong outputs from the generators.

Can someone suggest me some hints for this ?


Thanks in advance for your help Smile


Arshad
Re: Null references in Xtext when we do a clean build [message #1281686 is a reply to message #1281652] Tue, 01 April 2014 07:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13352
Registered: July 2009
Senior Member
Hi,

please give us more context: where do you get the NPE? Stackstrace?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon5.gif  Re: Null references in Xtext when we do a clean build [message #1281743 is a reply to message #1281686] Tue, 01 April 2014 09:41 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,

1. We do not get a NPE.
2. Array-instances of referenced objects are null.
3. We try to expand the instances of array_size(defined in .model1) in .model2.

For E.g. In my .model2 editor I refer object of .model1 editor something like this:

someEntity_i[array_size]


Here someEntity_i is an object in .model2 editor and array_size is an object in .model1 editor which is used as a reference here. array_size has value associated with it say it is 3, So someEntity_i will be transformed to someEntity_1,someEntity_2,someEntity_3.

When I edit and save, this model is transformed correctly as I get correct value for array_size but when I clean build the project this reference i.e. array_size is null.

Any ideas on this ? And is IXtextBuilderParticipant of any use here ?


Thanks in advance Smile


Arshad
Re: Null references in Xtext when we do a clean build [message #1281766 is a reply to message #1281743] Tue, 01 April 2014 10:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13352
Registered: July 2009
Senior Member
Still the question. Where are you in code. And what are you doing
there

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Null references in Xtext when we do a clean build [message #1282490 is a reply to message #1281766] Wed, 02 April 2014 11:34 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
I had a simular issue.
The name of the refernced object was null.
I did not found the cause but I have artifacts in my dsl for which I create my own names using the Nameprovider. When I separated these artifact into another resource all worked fine.


Xtext 2.8.1
Re: Null references in Xtext when we do a clean build [message #1282512 is a reply to message #1282490] Wed, 02 April 2014 12:06 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13352
Registered: July 2009
Senior Member
In the Nameprovider you SHOULD NOT use any references. use the NodeModelUtil to get the written text if neccessary

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:User-defined reusable type of properties and enumerations in "library" models
Next Topic:errors in MWE2 editor and Maven project
Goto Forum:
  


Current Time: Mon Feb 17 00:15:25 GMT 2020

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

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

Back to the top