This question might sound duplicate of this question but they are not the same. I am dealing with some legacy code in which logging was done at entry and exit of most (not all) of the functions of a some (not all) classes. This logging at the two points was added programmatically using Antlr or some similar tool. Now what I have is that legacy code which I want to migrate to the new style. The new style should add an annotation (which would instrument the code to add logging at entry and exit) at the top of each of those functions which had these type of logging and removing the code from those functions.
Taking the approach of Antlr to do this task is problematic because it is unable to understand the new syntax and semantics of Java and fails at multiple places. So what could be the best approach to for this problem?