-
1. Re: Generating source code in adition to class files
chiba Jul 19, 2005 9:37 PM (in response to hlovatt)Such a tool should be great but the implementation
would not be a simple task. First of all, decompiling
Java bytecode to appropriate source code is not always
possible (well, might be possible but difficult). Even
reflecting changes on bytecode to the original source file is
not easy since some bytecode manipulation by Javassist
is hard to represent in Java.
I agree your idea is great but I don't have a plan to do
it in near future... -
2. Re: Generating source code in adition to class files
genman Jul 20, 2005 12:48 AM (in response to hlovatt)There is a tool called "jode" which is 100% Java. This might work well enough, though it may not be able to handle modified .class files.
-
3. Re: Generating source code in adition to class files
hlovatt Jul 20, 2005 7:59 AM (in response to hlovatt)@genman,
Thanks for the tip - I will give jode a try -
4. Re: Generating source code in adition to class files
chiba Jul 21, 2005 9:04 AM (in response to hlovatt)I think using a Java decompiler is a good idea.
However, please don't say "Javassist has a bug!" if you see a decompiler fails to decompile the bytecode modified by Javassist. :-) -
5. Re: Generating source code in adition to class files
hlovatt Jul 21, 2005 7:16 PM (in response to hlovatt)I will keep that in mind, that a decompiler might struggle with a manipulated bytecode. Thanks for the advice.
For your interest Dennis Sosnoski, who as written about Javassist - I think you reference his articles, is talking about writting a library that can manipulate bytecodes and generate source.
His application is the same as mine, i.e. he wants to use apt and has also had trouble debugging code for which no source exists.
I think like me he is mainly interested in generating source from classes written from scratch, not from existing classes that have had their bytecode manipulated.
Also people are developing plug-ins for IDEs that allow source manipulation, e.g. JackPot for Netbeans. I think people are working on ones for Eclipse and IdeaJ also. I assume all this interest is like myself, because of apt. -
6. Re: Generating source code in adition to class files
michael-schnell May 2, 2009 5:19 AM (in response to hlovatt)Check out SrcGen4Javassist:
http://www.fuin.org/srcgen4javassist/index.html