Details
Description
Hi there,
I try to write a little mock generation application and fail when creating a class definition.
The output of my methods allways has a semicolon after the last brace.
My code:
// Create new source
final JavaSource source = new JavaSource();
// Create package information
source.setPackage("xyz.test");
// and an import
source.addImport ("import xyz;");
// add new class
final JavaClass targetClass = new JavaClass("MyMockClass");
// and a new public method
final JavaMethod javaMethod = new JavaMethod("myMethod");
javaMethod.setModifiers(new String[]
);
// which returns void
javaMethod.setReturns(Type.VOID);
// and has some code between braces
javaMethod.setSourceCode("
// add this method to our class
targetClass.addMethod(javaMethod);
// and the class to our source
source.addClass(targetClass);
// finally output everything
System.out.println(source);
And the output contains an unwanted semicolon after class definition:
package xyz.test ;
import import xyz;;
class MyMockClass {
public void myMethod(){...}
;
}
Could some one give me a hint how to solve his problem? Is suppose that this is a bug, isn`t it?
Thank you very much,
Maciej Andreas Bednarz
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.7 [ 11160 ] |
Sorry, I mean not class but method. The semicolon is after the method "}"