users@codemodel.java.net

Re: modifying existing classes

From: Jonas von Malottki <yoshtec_at_gmx.net>
Date: Mon, 15 Sep 2008 16:08:16 +0200

Kohsuke Kawaguchi wrote:
> dar imiro wrote:
>> I'd like to know if its possible
>> to generate a java-sourcefile, by using an existing .class-file as a
>> template. E.g. load the old class and start modifying it and finally
>> write it out as a new java source.
>
> No, codeModel doesn't have a discompiler, which is needed for doing what
> you do.
>
>> I guess you can load existing class and copy all its contents to a new
>> model, but this seems like too much work.
>>

Maybe you should try a different way. I guess Javassist could aid your
needs: http://www.csg.is.titech.ac.jp/~chiba/javassist/

Or you will have to check for a decompiler.

Greetings
Jonas