Search code examples
javascaladependenciesbytecode.class-file

Are there any libraries for extracting class, method, member and field dependency names from a .class file (bytecode)?


As the title says, are there any libraries for extracting class, method, member and field dependency names from a .class file (bytecode)?

For example, if I a compiled Scala .class file uses something like this:

var xs = new List[java.lang.String]();
"blah" :: xs;
xs(0).charAt(0);

I should get that I use these classes and methods:

java.lang.String
java.lang.String#charAt
scala.collection.immutable.List
scala.collection.immutable.List#apply

Is there any library with API I can use in my own Scala program that can do this for me?


Solution

  • Here is ASM framework tutorial explaining how to collect dependencies from classes.