I'm using Roaster(version 2.19.4.Final) to generate Java source files, and call function 'hasSyntaxErrors' to verify whether the class is valid before output it.
Below is my code, which I implement the interface Comparable. However it returns false by calling function 'hasSyntaxErrors', although I don't add a 'compareTo' function.
Any idea how to do the validation?
//create an empty instance
final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
//set the package name, and Java class name
javaClass.setPackage("demo.JavaCodeGenerator.roaster").setName("PersonPojo");
//add interface, can be one or more
javaClass.addInterface(Serializable.class);
javaClass.addInterface(Comparable.class);
if(javaClass.hasSyntaxErrors()){
System.err.println("SyntaxError: "+javaClass.getSyntaxErrors());
}