Make warnings show the right line number#1450
Merged
enebo merged 3 commits intojruby:jruby-1_7from Jan 27, 2014
Merged
Conversation
…warnings is one greater than the actual line number.
… of the actual line number. This fixes issue jruby#1446.
… that were computing things that were not used.
enebo
added a commit
that referenced
this pull request
Jan 27, 2014
Make warnings show the right line number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 printinglineNumber + 1instead oflineNumber. 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!