7
I need to find a way to find all the methods a class is using (watch out, it’s not the methods stated in it). EX:
public class Bondia{
public static void main(String[] args){
System.out.println("oi");
System.out.println(new Random().nextInt(10));
}
}
In this class, for example, I need to list the methods:
System.out.println();
java.util.Random.nextInt();
- and preferably the builder as well (
new java.util.Random()
);
Someone knows a way to do that?
This is not something that simple reflection solves. It needs something more complicated, that does bytecode analysis. Maybe some tool such as ASM or javassist.
– Victor Stafusa
There is something of Stacktrace that can do this, but I believe the best way would be using javassist.
– Renato Vieira Dantas
Use the JDK tool boar. It is disassemble of classes. Ex: no shell type in command line
$ javap -c java.lang.Object
– Augusto Vasques