I have recently been working with the Java library 'ASM', which is for modification of bytecode at runtime, in case people didn't know, and I have not been able to find a single tutorial on ASM 4. Except the official manual for ASM 4, which referenced ASM classes that didn't even exist.
I am wondering if anyone knows of any tutorials for the library, which cover basic to intermediate things, such as inserting some code into a method.
ASM simply stands for ASMifier tool.
The ASM library is a project of the OW2 consortium. It provides a simple API for decomposing, modifying, and recomposing binary Java classes (i.e. bytecode). The project was originally conceived and developed by Eric Bruneton.
Bytecode is the instruction set of the Java Virtual Machine (JVM), and all languages that run on the JVM must eventually compile down to bytecode. Bytecode is manipulated for a variety of reasons: Program analysis: find bugs in your application.
The ASM API provides two styles of interacting with Java classes for transformation and generation: event-based and tree-based.
What you want to do seems pretty basic (to me). I'd be very surprised if it was not covered, with an example, in the user guide: https://asm.ow2.io/asm4-guide.pdf
There is lots of other documentation linked here: http://asm.ow2.org/
The ASM mailing list is also quite responsive if you ask: http://mail.ow2.org/wws/info/asm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With