Bug 464566 - Line numbers mismatch in the sources
Summary: Line numbers mismatch in the sources
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sisu (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: consistency, core
Depends on:
Blocks:
 
Reported: 2015-04-14 02:54 EDT by Ilia Sretenskii CLA
Modified: 2021-10-25 16:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilia Sretenskii CLA 2015-04-14 02:54:59 EDT
Build Identifier: 0.3.0

I am debugging the code of an artifact and the stack trace contains lines from the org.eclipse.sisu.plexus-0.3.0.jar and the debugger knows the files and line numbers of those stack trace lines.
When stepping into those lines, the debugger takes the sources from the related file org.eclipse.sisu.plexus-0.3.0-sources.jar
But the problem is that it displays some incorrect lines in the source files, they are mismatched. In some cases the line count of a source file for a class is even less than the line number reported from the debugger.
I belive that it happened because those jar files were made from different sources.

Reproducible: Always

Steps to Reproduce:
1. Add dependency on org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.0
2. Debug the code stepping into that artifact classes
3. Download the sources will fetch org.eclipse.sisu.plexus-0.3.0-sources.jar
4. Compare the line numbers reported by the debugger and shown in the sources
Actual Results:  
Line numbers will be different, in some cases the reported line number even can not be found in the source file because it contains less lines

Expected Results:  
The expected behavior is that line numbers in the org.eclipse.sisu.plexus-0.3.0-sources.jar file should match exactly those reported by the compiled classes org.eclipse.sisu.plexus-0.3.0.jar file.

I have reproduced it with this artifact in the IntelliJ IDEA 14.1.1 editor debugger, while any other artifact matches the line numbers in their source files.
Comment 1 Stuart McCulloch CLA 2015-04-14 05:47:58 EDT
I took org.eclipse.sisu.plexus-0.3.0-sources.jar and compared that with the 0.3.0 tag and the sources are an exact match. I rebuilt the binaries with those sources and get the same bytecode.

I also debugged a simple project from Eclipse and the line numbers in the debugger matched those in the tagged source code. So far I haven't been able to recreate any discrepancy between the lines declared in the bytecode vs those in the sources.

Could you provide a concrete example of lines which were incorrect in the debugger?

(or even better a sample project which recreates the issue you're seeing)
Comment 2 Ilia Sretenskii CLA 2015-04-17 07:59:19 EDT
Thank you for your attention, Stuart.
I have experimented more and figured out the cause.

As I change the dependency version if effects in the sources that the IDE debugger uses to display the source code of the stack trace classes.
But the line numbers reported in the stack traces seem to come actually not from the dependency versions, but from the Maven binaries.

I have found it as I changed my environment between Maven 3.0.5 and Maven 3.3.1

Namely, as I change the dependency version, only the displayed source code in the editor changes, but the line numbers reported by the debugger in the stack trace remain the same.
Also, as I change the Maven version in my environment, the source code in the editor remains the same, but the line numbers reported by the debugger in the stack trace changes.

Thus, there is a correct match of line line numbers of the artifact.
The mismatch comes on the debugger, probably, or maybe close to it.
Instead of reporting the underlyig running Maven libraries, it reported those mentioned in the dependencies, but they were not actually running.

This bug report happens to have been a misunderstaing on my side.
Please, close it.
Comment 3 Ilia Sretenskii CLA 2015-04-17 08:04:42 EDT
By the way, the solution to my issue was to specify only those versions of these artifacts, which exactly match the current installed Maven version of the environment. The tricky part was to find the artifact version which would match the current Maven version exactly.
Comment 4 Stuart McCulloch CLA 2015-04-23 20:33:03 EDT
Hi Ilia, thanks for the update - closing as requested.