Change Java Source Code with Javalang
maurovit opened this issue · 2 comments
maurovit commented
Hello,
i have a problem: I want to parse a java source code file, then modify some part of code, like replace some method invocations and insert some piece of code, and then write the new modified source code back. How can do this with javalang?
Is it possible to modify MethodInvocation and write the modified version back?
lyriccoder commented
This functionality is not supported by this framework, It requires code generation. Use tree_sitter.
tyjman commented
How about just allowing for modifying things like tokens and identifiers (names) for variables, methods, classes, etc.? Would that be feasible? I don't need to modify the code itself I just want to rename some things quickly.