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

StackOverflow https://stackoverflow.com/questions/11360162

Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

You need to be able to read the code of method bodies. I would use a byte code library such as ObjectWeb's ASM, BCEL or JavaAssist.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top