Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

__FUNCTION__ in java?  RSS feed

 
Bob Cernohous
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anything equivalent to c/c++ compiler's __FUNCTION__,__LINE__, __FILE__, etc. in java? I just wanted a generic way to put the current function name in a string for debug purposes.
 
Ryan McGuire
Ranch Hand
Posts: 1142
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the getStackTrace() method in Throwable.

You might do something like...


I haven't tried this code snippet, but you see what I'm getting at.

Ryan
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!