Parsers like JavaCC, SableCC and Antlr have grammars available that can read Java syntax. It would be up to the developer to use those in a way that they generate the (possibly altered) original source code as output.
Does this have to work on source files? I could see it being easier if it was being applied to class files. Obviously that depends on what, exactly, you intend to alter.
posted 10 years ago
Yah i want to do the changes on the source code as further changes on the same java file and again recompiling will remove the previous changes...