It is possible to get current line number by __LINE__ in Ruby or Perl.
For example:
print "filename: #{__FILE__}, line: #{__LINE__}"
Is there the same feature in Groovy?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not directly, but you can get it through an Exception (or Throwable) stack trace. For example:
A word of caution though: getting the line number, file name, or method like this is very slow.