JvmModelInferrer: Serializing a JvmTypeReference and Generating a method body [message #1143822] |
Fri, 18 October 2013 12:53 |
Victor Noël Messages: 112 Registered: June 2010 |
Senior Member |
|
|
Hi,
I'm writing a JvmModelInferrer in which I create classes with methods with bodies.
In these body, I would like to declare variables of a given type, so I do something like that:
body = [
aType.newTypeRef().serializeSafely(it)
append(" varName = methodCall();")
]
newTypeRef comes from JvmTypesBuilder and serializeSafely comes from ErrorSafeExtensions.
The problem is that because this JvmTypeReference does not have any eContainer, when serialize (from TypeReferenceSerializer) is called by ErrorSafeExtensions with context set to the JvmTypeReference's eContainer which is null, I get a NPE...
Question:
1) is that the correct way of serializing a JvmTypeReference?
2) is there a better way to generate the body of the method? For example by building an XEpression instead of doing it by hand? How to build such an XEpression?
Thank you
Victor
[Updated on: Fri, 18 October 2013 12:53] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03768 seconds