Alternative to Eclipse Abstract Tree Parser for Code Processing

Background

I am writing a program that will perform mass renaming of members and functions in the java source code directory in order to neutralize code based on the .csv lookup table passed to the program.

What is it that the source code that I wrote was written against obfuscation. I have a de-obfuscated version of jar that ran through a custom version of RetroGaurd , and I would like to parse the mapping file that was passed to to RetroGaurd to disable the function that called my source code in the jar. If I just compile my code and run it through RetroGaurd when I decompile, I have lost all my wonderful comments and formatting (unless there is a RetroGaurd option that I missed).


Problem

I found the Abstract Syntax Tree parser built into Eclipse, and it is great for my purposes, however I do not plan to write my program as a plug-in for Eclipse, it will be a separate bank that can be run on any machine.

My main problem is that when I write my code, I get a lot of dependencies on the internal jars that Eclipse uses. I know that if I agree with the EPL for libraries, I will not have problems distributing it, but I am worried that this project is more and more as I write this, as more and more cans of the Eclipse SDK are required.

Are there any other projects that would give me the opportunity to analyze the Java source code to find and replace reliably, as AST will give me, or is there a way to use RetroGaurd (or such a program) to run the same de-obfuscation, but leave my comments and functions the same without having to start de-obfuscating the program, although after that the compiler?

+6
source share
1 answer

If you are concerned about running the Eclipse GUI to execute your code, you might consider running the plugin in headless mode. This will launch your plugin from the command line. See this SO stream .

You can also use any other open source java compiler. For example, openjdk Java compiler . See the Resources section.

Hope this helps.

0
source

Source: https://habr.com/ru/post/908923/


All Articles