In a relatively complex project I have many runnables defined like
Runnable foo = () -> {
// bar
}
'foo' is passed through several objects and executed at some point. Now for debugging purposes, I'd like a smooth way of retrieving in what file and in what line the runnable has been initialized and that without adding any code into the runnable (like working with the stacktrace).
In other words, I need a function which tells where an object has been created. Is there any reflection method in Java for this purpose?
Huge thanks in advance!
Aucun commentaire:
Enregistrer un commentaire