Search code examples
javaframeworksbytecode-manipulation

Java Bytecode Manipulation Library Suggestions


I'm looking for a well-maintained Java bytecode manipulation library with an intuitive API. There seem to be quite a lot of them out there. Any suggestions on which ones to try?


Solution

  • The best answer to your question will be governed by your specific needs and objectives; if you can expand upon what you're trying to accomplish, I can perhaps offer a more tailored response.

    In lieu of that, however, in my experience, ASM offers probably the best combination of maturity, flexibility, and ease-of-use:

    • It's under relatively active development: even though the latest release is from June 2009, developers are regularly making commits to their VCS.
    • It's already in wide use in a number of prominent Java products, such as AspectJ, Groovy, Cobertura, and many others, which promises a wide user-base and thus a wide community for support.
    • It's fairly thoroughly documented, and there are a number of tutorials, user guides, and reference documents available both from the OW2 Consortium and the community at large.

    N.B. The comment @Yuri left below describes a situation I personally haven't yet encountered but that may potentially pose a significant obstacle. Keep his observation/experience in mind while evaluating the various bytecode manipulation libraries.