There are several other changes introduced in ASM 2.0.
- Introduced the new interfaces
visitCode()method added to the
MethodVisitorto easily detect first instruction.
Constantsinterface renamed into
- Almost all attributes from the
attrspackage are incorporated into ASM's event model.
TreeCodeAdapterare incorporated into the
- Introduced the
LabelNodeclass to make elements of
instructionscollection common type of
In general, it would be a good idea to run tool like JDiff and review the differences between the ASM 1.x and 2.0 APIs.
ASM 2.0 hides many bytecode complexities from the developer and allows one to efficiently work with Java features on a bytecode level. The framework allows you not only to transform and generate bytecode, but also to pull out significant details about existing classes. The API is being constantly improved--version 2.0 incorporates the generics and annotations introduced in J2SE 5.0. Since then, support for the new features introduced in Mustang (see "Java SE 6 Snapshot Releases") have been added to the ASM framework.
- Java Virtual Machine Specification
- "Revised Class File Format" (Chapter 4 of the JVM specification; PDF). Includes modifications for J2SE 5.0 to support changes mandated by JSR-14, JSR-175, and JSR-201, as well as minor corrections and adjustments.
- "Using the ASM Toolkit for Bytecode Manipulation"
- "Create and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit"
- Bytecode Instrumentation (BCI). Kelly O'Hair discusses challenges in bytecode instrumentation.
Eugene Kuleshov is an independent consultant with over 15 years of experience in software design and development.
Return to ONJava.com.