By mostlyharmless
via warneronstine.com
Submitted: Mar 27 / 14:57
Have you ever wondered how to find the Class that has just called your class? Well, now you can (or rather you always could) by using this little trick that I got from my friend and former co-worker Leo.
Comments
willcode4beer replied ago:
Completely evil hack, but, I can see it being useful when debugging.
mostlyharmless replied ago:
No doubt. If I really need to do that, I would look at the source for Throwable().getStackTrace() and copy that.
srt replied ago:
You won't be able to do that because its done in native code (Thread#getStackTrace as well)
b0b0b0b replied ago:
yawn
Voters For This Link (13)
Voters Against This Link (3)