Java 字节码操作库建议

2022-01-16 00:00:00 frameworks java bytecode-manipulation

我正在寻找一个维护良好且具有直观 API 的 Java 字节码操作库.那里似乎有很多.有什么可以尝试的建议吗?

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?

推荐答案

您的问题的最佳答案将取决于您的具体需求和目标;如果您可以扩展您想要完成的工作,我或许可以提供更量身定制的回复.

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.

然而,根据我的经验,ASM 可能是成熟度的最佳组合,灵活性和易用性:

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

  • 它处于相对积极的开发阶段:尽管最新版本是 2009 年 6 月发布的,但开发人员仍会定期提交其 VCS.
  • 它已经在许多著名的 Java 产品中得到广泛使用,例如 AspectJ、Groovy、Cobertura 和许多其他产品,这保证了广泛的用户群和广泛的支持社区.
  • 文档相当详尽,OW2 提供了许多教程、用户指南和参考文档联盟和整个社区.
  • 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.

注意@Yuri 下面留下的评论描述了我个人尚未遇到的情况,但这可能会构成重大障碍.在评估各种字节码操作库时,请牢记他的观察/经验.

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.

相关文章