Ah, good old Java bytecode. We’ve discussed this in the past with a report called Mastering Java Bytecode at the Core of the JVM, but let’s jog your memory once again: Bytecode is the binary representation of your source code that the JVM is able to read and execute.
Bytecode libraries are widely used in Java today, especially within Java EE, where proxies–dynamically generated at runtime!–are used extensively. Transforming bytecode is also a common use case, for instance for supporting runtime-weaving of aspects in AOP, or to support the extended class-reloading technology that tools like JRebel offer. We also see the usage of the libraries for parsing and analysing bytecode, for instance in the code quality area.
There are multiple bytecode libraries available for you to choose from if you want to start transforming a class’ bytecode, among the most widely used ones are ASM, Javassist and BCEL. In the full post we’ll look at bit at ASM, and JiteScript, which is an API on top of ASM, offering a more fluid API for generate classes, and, importantly, your own lambdas!
Read the full story here: http://zeroturnaround.com/rebellabs/how-to-ez-bake-your-own-lambdas-in-java-8-with-asm-and-jitescript/