This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 158082 - Allow ordering of the sources used by debugger
Summary: Allow ordering of the sources used by debugger
Status: NEW
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-06 14:42 UTC by shishirvd
Modified: 2013-12-12 13:43 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shishirvd 2009-02-06 14:42:24 UTC
The problem occurs when I have java class say Abc.class in a jar file and have attached a source using Edit Jar Reference.
And then I have the same java file Abc.java in my source folder.
On putting a breakpoint in Abc.java in the project source folder the control jumps to the attached source of the jar
file while debugging. 

So I tried adding the project source folder(both comma(,) seperated or semi colon(;)seperated) in the Edit jar reference
since the jar is updated everytime. But NetBeans picks up only the first path and ignores the second one.

And this is how I stumbled upon this defect/enhancement.
So, is there a way to attach multiple source folders to a single jar file.
Let assume, that a jar file contains Abc.class and Def.class file.
And Abc.java is in source folder 'src1' and Def.java is in 'src2'

Please let me know if you need any more information on this.
Comment 1 Milos Kleint 2009-02-06 15:32:03 UTC
if you have the class file as jar/folder dependency and at the same time have the relevant java file in source files you
might have a misconfigured project.

-> enhancement. I don't see why a single jar file shall have multiple source jars attached. A simple workaround is to
combine the multiple source jars into one..
Comment 2 shishirvd 2009-02-06 16:01:34 UTC
Let me explain in more detail:

The jar file is a part of the base product and there is a source code available say in src.zip.
And lets say the jar has 100 classes and I edit the jar reference with src.zip to attach source.
These source need not be modified(unless an enhancement is needed) and are not part of the the project source folder.

But now one of the files (say Abc.java) that is in the base product i.e. in src.zip needs to modified and the other 99
remain untouched.
So, I add this Abc.java to the project source folder and extend its functionality by adding a method and I add a
breakpoint in this method. 
On attaching the debugger the breakpoint isnt submitted becuase the class exists in the jar file as well NetBeans picks
up the class in the jar and not the one for the java file in the source folder.

I hope I have explained it well this time and you understand the problem. 

Please assist me in resolving this problem if it is a configuration problem.
Comment 3 malfunction84 2009-02-06 18:41:57 UTC
It sounds like you're basically "overriding" the class that's in the included .jar by copying the source for that class
into your project's source.  Then when you attach breakpoints and run the debugger, it brings up the source in the
src.zip file (the one attached to the included .jar) instead of the "overriding" copy of the source that's in your project.

Is that correct?
Comment 4 shishirvd 2009-02-06 18:50:12 UTC
Yes that's correct. I am overridding the copy of the source.
Comment 5 Tomas Zezula 2011-04-21 07:27:28 UTC
The title of issue is misleading.
If I understand it correctly the reporter want to prefer source in project to library source (both have the same fqn).
The ordering is done by debugger. You can turn off the usage of library source in the Window/Debugger/Sources window.
Comment 6 shishirvd 2011-04-22 13:01:28 UTC
Hi Tomas,

Thank you for the response.

I am not sure if your suggestion would work. Lets say, product.jar and the corresponding source product-src.jar contain 100 classes. Out of these 100 classes I choose to override one class Abc and the overriden source is in the project.

So, to make the project source available to the debugger we will disable the library source, but as a result of this the source for the remaining 99 classes in product.jar will not be available.

My suggestion on this would be, to change the way in which the debugger looks for the source. If preference is given to the project source folder and then the library source then this issue might get resolved. 
I really don't know how Netbeans debugger resolves the source files and this might bit be completely out of context.

Thanks,
Shishir
Comment 7 Tomas Zezula 2011-04-26 13:09:53 UTC
Hi Shishir,
you are right. If part of the sources comes from project sources and the rest from attached zip turning off the attached zip does not help.

>My suggestion on this would be, to change the way in which the debugger looks
>for the source. If preference is given to the project source folder and then
>the library source then this issue might get resolved.
Yes, this will help
Comment 8 IrianR 2013-12-12 13:22:09 UTC
I think this enhancement could be considered RESOLVED since there are two right click menu items in the debugging -> sources window to move up and down the various source roots, no idea when this was added.


However I've sometimes had to use this feature (due to my sources being messy like the original reporter ones), and I find it difficult to move the source roots around one line at a time, to make this feature really usable IMHO another set of menu items should be added to move the selected source root to the first and last position in the list.