I’d like to start using Java ASM to transform classes in my project – to add one String argument to some methods and send log with this argument.
On asm website I’ve read
If you want to implement a class transformer, write two Java source
files (before and after transformation) and use the compare view of
the plugin in ASMifier mode to compare the equivalent ASM code.
But I find using Java ASM extremely hard. Is there any tool which can generate class transformer? It would be very useful!
If you are using Eclipse, you should install Bytecode Outline – it calls ASMifier (mentioned by Peter Lawry in another answer) and provides a view that can inspect every class or method.
EDIT (copied from my comment below)
To get to the transformer you need, follow theses steps: write an example method, copy the code to create it (which you get by clicking the Icon with “ASM” on it), change its sources to what you want it to be after transformation, copy its output, put them in a diff program (I like and recommend Diffuse). See what changed in the ASM code, apply it in your ASM transformer.