- The ASM library is designed to work on compiled Java classes. It was also designed to be as fast and small as possible.
- ASM provides tools to read, write and transfrom such byte arrays by using higher level concepts then bytes such as numeric constants, strings, Java identifiers, Java types, Java class structure elements.
- The ASM is just a reference to the
__asm__
keyword in C. - The core API provides an event based representation of classes, while the tree API provides an object based representation.
- The
CheckClassAdapter
class could be used to check if the bytecode generated by ASM is valid. - The
ASMifier
class could be usedd to generate the source code of ASM for generating a specific class. - Argument values are statically known and are stored in the compiled code, while operand values come from the operand stack and are known only an runtime?
LocalVarialbeSorter
is useful to insert new local variables in a method. Without this adapter it would be nassessary to add new local variables after all the existing ones, but unfortunatelly their number is not known until the end of the method, invisitMaxs
.
- The tree API is generally used for transformations that cannot be implemented in one pass with the core API. But, there are of course exceptions. For example an obfuscator.
- It is possible to use the tree API only for methods, and the core API for classes. In practice this strategy is often used.