Java: Easy way to get method stub out of class files within a JAR file? Reflection?

后端 未结 2 1335
天涯浪人
天涯浪人 2021-02-04 17:41

I\'m searching for a way to get a list of method stubs of all classes within a jar file. I\'m not sure where to start... May I use Reflection or Javassist or some other tools of

2条回答
  •  太阳男子
    2021-02-04 18:25

    The best way I can think of is to use the ASM-bytecode framework. Then at least you wouldn't have to go through some decompilation-output with a line-parser. In fact, getting the method-stubs should be like a 20-line implementation of one of their Visitor-interfaces.

    I've used it myself for bytecode rewriting and it's fairly simple and straight forward (especially if you're just reading the class-files).

    http://asm.ow2.org/

提交回复
热议问题