samedi 25 juillet 2015

How to get multi-signature caller method with reflection?

Suppose we have:

public void caller(Object obj){
      called();
}
public void caller(){
      called();
}

as you can see, caller has two signatures. In order to get the stack trace we can use:

StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();

But it only returns the name of the method. How can I find the actual true caller?





Aucun commentaire:

Enregistrer un commentaire