«« Next » « Previous
«« Next » « Previous

Link Details

Link 73001 thumbnail
User 217678 avatar

By mostlyharmless
via warneronstine.com
Published: Mar 27 2008 / 17:16

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.
  • 13
  • 3
  • 2187
  • 942

Comments

Add your comment
User 209464 avatar

willcode4beer replied ago:

0 votes Vote down Vote up Reply

Completely evil hack, but, I can see it being useful when debugging.

User 217678 avatar

mostlyharmless replied ago:

0 votes Vote down Vote up Reply

No doubt. If I really need to do that, I would look at the source for Throwable().getStackTrace() and copy that.

User 167877 avatar

srt replied ago:

0 votes Vote down Vote up Reply

You won't be able to do that because its done in native code (Thread#getStackTrace as well)

User 171944 avatar

b0b0b0b replied ago:

0 votes Vote down Vote up Reply

yawn

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.