Generating "void" methods using JvmTypesBuilder.toMethod. [message #756094] |
Thu, 10 November 2011 15:41  |
Eclipse User |
|
|
|
I am trying to generate a method with return type "void" using the JvmTypesBuilder.
I noticed that the JvmTypesBuilder.toMethod takes a JvmTypeReference as parameter.
Simply passing "null" generates a method with returnType "void" but it automatically adds a return statement.
This is incorrect Java code and as a result is not compilable:
public void test() {
return null;
}
In the JvmModelInferrer I have the following:
members += f.toMethod(f.name, null) [
documentation = f.documentation
for (p : f.params) {
parameters += p.toParameter(p.name, p.parameterType)
}
body = f.body
]
Passing a JvmVoidImplCustom doesn't work since this is not a subtype of JvmTypeReference.
What is the right way of generating a method with returnType "void" and without a return statement?
Thanks in advanced
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.29231 seconds