Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make warnings show the right line number #1450

Merged
merged 3 commits into from Jan 27, 2014

Conversation

Projects
None yet
2 participants
@DavidEGrayson
Copy link
Contributor

DavidEGrayson commented Jan 27, 2014

As discussed in issue #1446, JRuby warnings (or at least some types of them) were always reporting a line number that was one greater than reality. This pull request fixes the issue and adds a regression test.

There were two places in RubyWarnings.java (one deprecated) where the code was explicitly printing lineNumber + 1 instead of lineNumber. I think we should have a convention where the term "line number" is 1-based and we try to use that everywhere. If we have to use a 0-based number for a line it should be called a "line index" and it should have lots of comments about how it is not actually a "line number".

Unfortunately, my change might cause some other type of warning to have line numbers that are too small by one. I might look into setting up Eclipse so I can find all references to that code and make sure they are passing in proper line numbers instead of line indices.

I also tacked on a third commit that removes some unused code from ThreadContext.gatherCallerBacktrace. I found it while looking for the bug. I hope that's OK!

DavidEGrayson added some commits Jan 26, 2014

Added a regression test for issue #1446: Line number in runtime warni…
…ngs is one greater than the actual line number.
ThreadContext.gatherCallerBacktrace: Got rid of several lines of code…
… that were computing things that were not used.

enebo added a commit that referenced this pull request Jan 27, 2014

Merge pull request #1450 from DavidEGrayson/warning_line_pull_request
Make warnings show the right line number

@enebo enebo merged commit 825cb8f into jruby:jruby-1_7 Jan 27, 2014

1 check failed

default The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.