Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java Bytecode to Eclipse AST parser?

Can you recommend some library that presents Java bytecode as Eclipse's Java AST (ie. with nodes descending from org.eclipse.jdt.core.dom.ASTNode) ?

like image 524
Aivar Avatar asked Mar 23 '26 12:03

Aivar


1 Answers

You're looking for a decompiler, and a way to turn that tool's AST representation into Eclipse's AST representation.

Java Decompiler has an Eclipse plugin to re-create source code. You could parse that with Eclipse's ASTParser to get the AST you want (or maybe you just wanted the source code to begin with).

The biggegst roadblock you'll run into is when the decompiler cannot accurately re-create original source code syntax (either because of obfuscation or because it simply cannot understand a bytecode construct). What sourcecode does it generate? How then does the Eclipse ASTParser handle that? YMMV.

There are many decompilers for Java, all with varying abilities depending on the compiler/obfuscator which created the bytecode it is attempting to decompile. If Java Decompiler doesn't work for you, you might create an eclipse plugin for one of the others.

like image 178
Chadwick Avatar answered Mar 25 '26 02:03

Chadwick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!