Search code examples
javajarbinarymethod-signature

How can I get the function sinatures from a jar file?


In Eclipse or NetBeans, when you "control + click" into a function, you can at least see its entire signature, even if it's in a jar file.

I am wonderging if it's possible to write a tool to pull out all the function signatures from a jar file. Is there any API for this?

I know jDepend seems to offer functions for this. However, I believe that there are some more generic ways to do this.


Solution

  • Jars are zip files so you can use the zip routines to get the byte code defintion for each class in the jar file.

    Then, given the byte code, you can use a byte code analysis tool like javassist to load the byte code into a ClassFile, and then get the MethodInfo's which you can then process as you like.