Let's say we have a program with a method void foo(int a, int b, int c), and we have a list of statements given in string formats like "System.out.println(a);" or "int q = a+b+c;" or "try{int d = a/b;}catch(Exception e){}". Is there a convenient way to insert these statements into foo using Java Parser?
Note that the statements are given in string format and we do not know beforehand what the statements are, so it seems extremely hard to build the statement up using BlockStmt, NameExpr, FieldExpr, etc. because that would require parsing the statement string into these fields. Is there any way Java Parser can add the string-formatted statements without needing me to write a statement string parser?