Java Bytecode Manipulation Library Suggestions

前端 未结 3 579
梦谈多话
梦谈多话 2020-12-30 06:17

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

3条回答
  •  说谎
    说谎 (楼主)
    2020-12-30 06:51

    That actually depends on how you define intuitive ;-) I started using ASM two weeks ago for a certain task on my current project and it worked like a charm. It only took me a couple hours to understand it and be able to use it, but I wouldn't exactly call the API intuitive. But if you know a little bit about Java bytecode and are familiar with the visitor pattern, the learning curve is not very high, IMO.

    Another advantage of ASM is that it is apparently bundled with the standard API at least in the Sun JDK, although in a different package (com.sun.xml.internal.ws.org.objectweb.asm and subpackages).

提交回复
热议问题