Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » existent JVMInferrer does not work any more(I have a JVMInferrer which worked fine till Xtext 2.8, but now with Xtext 2.10 it does not work anymore)
existent JVMInferrer does not work any more [message #1739404] Sun, 31 July 2016 23:51 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I have the following code in my JVMInferrer:
		... //variables declared here
		acceptor.accept( element.toClass(className)) [
			abstract = true
			members += element.toField("TABLE_NAME", typeRef(String)) [
				visibility = JvmVisibility.PUBLIC
				final = true
				static = true
				initializer = '''"«tableName.toLowerCase»"'''
			]
		]

The lambda expression for the class element is not executed any more due to a NullPointerException. As I could figure out the members element isn't initialised any more with an empty list.

This code example follows the example from the eclipse Xtext documentation.

What I do wrong ?

Re: existent JVMInferrer does not work any more [message #1739406 is a reply to message #1739404] Mon, 01 August 2016 03:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
Can you Share a complete minimal reproducing inferrer

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: existent JVMInferrer does not work any more [message #1739432 is a reply to message #1739404] Mon, 01 August 2016 09:29 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Where is the NullPointerException raised? I could only imagine this for variable 'tableName'. I cannot imagine why this 'tableName' should evaluate to null.

But you could try this (just a guess):
... //variables declared here
		acceptor.accept( element.toClass(className)) [
			abstract = true
			members += element.toField("TABLE_NAME", typeRef(String)) [
				visibility = JvmVisibility.PUBLIC
				final = true
				static = true
                                if (tableName != null) {
 				   initializer = '''"«tableName.toLowerCase»"'''
			       }
			]
		]
Re: existent JVMInferrer does not work any more [message #1739453 is a reply to message #1739432] Mon, 01 August 2016 18:32 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Karsten Thoms wrote on Mon, 01 August 2016 05:29
Where is the NullPointerException raised? I could only imagine this for variable 'tableName'. I cannot imagine why this 'tableName' should evaluate to null.
[/code]

As I wrote the members field is not initialized so the NPE must be raised at "members += ...". All other variables are definitely initialised.

members is a list field and formerly got initialised with an empty list by the EMF-Getter. It seems to be not the case any more.

My problem is I could not debug into the lambda-expression. That makes it difficult to tell what really happens.
Re: existent JVMInferrer does not work any more [message #1739455 is a reply to message #1739453] Mon, 01 August 2016 18:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
Thus again the question. Can you share a minimal reproducing example

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: existent JVMInferrer does not work any more [message #1739458 is a reply to message #1739406] Mon, 01 August 2016 21:26 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Sun, 31 July 2016 23:04
Can you Share a complete minimal reproducing inferrer

I tried but when I create a new project with Xtext 2.10 it allways works.
I guess because it is code from an older Xtext project the old structures does not fit to the new Xtext libraries.

How can I easily migrate my project to the new Xtext 2.10 structure ?
Re: existent JVMInferrer does not work any more [message #1739462 is a reply to message #1739458] Tue, 02 August 2016 03:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
There is no easy way. But it has to work with the old infrastructure as well so having a least a complete inferrer class with imports and method signatures might help to reproduce

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: existent JVMInferrer does not work any more [message #1739655 is a reply to message #1739462] Wed, 03 August 2016 13:47 Go to previous message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Mon, 01 August 2016 23:03
There is no easy way. But it has to work with the old infrastructure as well so having a least a complete inferrer class with imports and method signatures might help to reproduce

My project generators are to complex to create a minimal example from it.
I created a new Xtext project and I am moving my code to the new Project.
Thank you all for your replies.
Previous Topic:XML model to DSL syntax transformation
Next Topic:XcoreLang.xcore file unmapped in Tycho build
Goto Forum:
  


Current Time: Thu Feb 22 19:07:07 GMT 2024

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

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

Back to the top