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
) ?
views:
44answers:
1You'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.