I want to create Java source code with code snippets that are possibly syntactically invalid. That's possible with com.sun.codemodel.JBlock#directStatement() method.
My problem is, that I want to modify existing (syntactically valid) source files and I can't find a way to create a JCodeModel from a file (or a String or a Stream etc.).
Is there a way to do this with JCodeModel?
(I could use Eclipse JDT/AST framework instead, but it apparently doesn't offer the option to add code snippets directly...)