ASM gains ground

CGLib now uses ASM instead of BCEL.

CGLib really is pretty cool. One of my colleagues, Chris, had a go at writing an enhancing classloader using CGLib, but ran into difficulties with final classes and classloader recursion. It ought to be possible, and that seems to me to be the most logical place to inject the enhanced bytecode. The rest of the application would then be completely unaware of the enhancement and could just instantiate classes in the usual way.

Advertisements

One thought on “ASM gains ground

  1. Yes, final classes or methods cause problems, since you can’t extend the class.

    There are times when hooking into the ClassLoader is more appropriate, but that is not always a possibility. The nice thing about CGLIB is that it will work in any Java environment, JDK 1.2 or up.

Comments are closed.