I have recently come into the need of modifying some Java code (adding methods, changing the signatures of some fields and removing methods) and I think that all of this can be
You can do this with Eclipse by calling APIs that let you manipulate the ASTs.
Or you can apply program transformations to achieve your effect in way that doesn't depend on the microscopic details of the AST.
As an example you might write the following program transformation:
add_int_parameter(p:parameter_list, i: identifier): parameters -> parameters
" \p " -> " \p , int \i";
to add an integer parameter with an arbitrary name to a parameter list. This achieves the same effect as a whole set of API calls but it is a lot more readable because it is in the surface syntax of your language (in this case, Java).
Our DMS Software Reengineering Toolkit can accept such program transformations and apply them to many languages, including Java.