existent JVMInferrer does not work any more [message #1739404] |
Sun, 31 July 2016 23:51  |
Eclipse User |
|
|
|
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 #1739432 is a reply to message #1739404] |
Mon, 01 August 2016 09:29   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
Karsten Thoms wrote on Mon, 01 August 2016 05:29Where 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 #1739458 is a reply to message #1739406] |
Mon, 01 August 2016 21:26   |
Eclipse User |
|
|
|
Christian Dietrich wrote on Sun, 31 July 2016 23:04Can 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 #1739655 is a reply to message #1739462] |
Wed, 03 August 2016 13:47  |
Eclipse User |
|
|
|
Christian Dietrich wrote on Mon, 01 August 2016 23:03There 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.
|
|
|
Powered by
FUDForum. Page generated in 0.05576 seconds