I'm not sure what you're trying to do here. There are a few things that look like they are probably mistakes to me:
- You have a variable called statement that seems confusingly named: it is used to store the value of a field (a raw value, not a statement or code), and then gets inserted as the argument to println as if it were code that evaluates to a value. If the field contains text to be printed then you will need to pass it through the quote function on your code generator object (see e.g. here for the text block JavaScript generator function).
- You include a tab character in the generated code, but (as I already explained in another thread) you don't need to do that because the code that calls this function will do the indentation for you.
- The last line prepends a (lone) double quote to the generated code, which seems likely to make it syntactically invalid.
All in all, if the field named statement contained the value 'Hello, World!', then this function would return '"\tSystem.out.println(Hello, World);'—not valid code in any programming language that I'm aware of.
Best wishes,
Christopher