1 Reply Latest reply: Mar 29, 2008 5:42 PM by Carlos XXXXX RSS

Suggestion for CodeConverter

Carlos XXXXX Newbie

Hi all,

I would like to make a simple suggestion that imo would make the
javassist's CodeConverter a lot more useful than it is now.

Namely, that the static replacements for fields and methods take not
only the target object but the respective ctfield or ctmethod also.
This way, you're not forced to keep a 1-1 relation between the
replacements and the originals, being able to dynamically change
reaction in view of the currently accessed field or method instead.

For example a replacement for a field read could lookup a bean in a
registry addressing it by a name that could be the field name itself,
or a name synthesized from its class, or maybe an identifier provided
by an annotation. This would implement an style of dependency

What do you think?


  • 1. Re: Suggestion for CodeConverter
    Carlos XXXXX Newbie

    PS: Or, if it's too expensive or difficult to build the respective CtMethod or CtField, the Method or Field obtained by reflection instead, or maybe the bytecode descriptor for the signature (althought this last option conflicts with javassist approach).