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 226042 - goto-method selects file from wrong project
Summary: goto-method selects file from wrong project
Status: RESOLVED INCOMPLETE
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-13 02:42 UTC by greggwon
Modified: 2013-03-08 00:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
debugger console messages (3.56 KB, text/plain)
2013-03-07 23:05 UTC, greggwon
Details
the editor window showing the lines not matching (88.31 KB, image/png)
2013-03-07 23:09 UTC, greggwon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description greggwon 2013-02-13 02:42:42 UTC
I have versions/branches of the same project visible as separate projects to netbeans.  I've been able to edit the different projects' contents independantly with all previous versions of netbeans.   Sometime in version 7.2, netbeans has started using the wrong projects meta data for "type resolution".  If I have more than one of these projects opened when I start netbeans, rather than using the classpath/libraries to resolve which source tree to use, it seems to pick some other version/branch and use that.  The meta data is compiled from the wrong source tree, and the errors shown are not real errors.  Then, when I use goto-method by shift clicking on a method invocation, shown as an error, it opens the source file containing that class, in the wrong project.  I.e. netbeans is just using one of the other projects, instead of using the library/classpath of the project.
Comment 1 greggwon 2013-02-13 21:28:03 UTC
I am going to change this back to P1.  Sure there is a work around, but when the differences are subtle or small between the two or more versions of the file, this can cause you to do something which 1) never fixes the build in the problem file, 2) causes you to change/corrupt another build, unbeknownst to you, and 3) this is a regression that needs to be addressed.
Comment 2 Marian Mirilovic 2013-02-14 08:49:33 UTC
Following http://wiki.netbeans.org/BugPriorityGuidelines this is hardly a P1 (stopper for 7.3).
Comment 3 Dusan Balek 2013-02-14 09:00:06 UTC
Unfortunately, I cannot reproduce the problem on my test case (two different versions of the javac sources opened simultaneously in the IDE). Could you please create a simple test case and attach it to the issue with the exact steps to reproduce? Thanks.
Comment 4 greggwon 2013-02-14 13:44:19 UTC
What I did to see this behavior, is have three different projects opened with different versions of the same classes.  The source trees are different and the netbeans project files are different.  I saw it first when I upgraded from 7.2 to 7.2.1, and then I saw it again when upgrading from 7.2.1 to 7.3rc2.  In both upgrades, I accepted the option to migrate the projects from the previous version of netbeans to the upgraded version.
Comment 5 Dusan Balek 2013-02-14 14:07:16 UTC
The issue is hard to fix without a reproducible test case. So, could you please attach the particular projects to the issue and describe the exact steps to reproduce? Thanks.
Comment 6 greggwon 2013-02-21 23:44:21 UTC
It's not really possible or helpful, I think, to do this.  Just create a project with a source tree in it.  Make 3 copies of the project and source tree, by just using "tar" or "rsync" or whatever to replicate the directories.  Now, open all three projects in netbeans 7.2.  Just put one source file in there, and make sure that you now go into each "copied project", and change the API on a method to have disparate return types and/or argument counts/types.    Next, upgrade to 7.2.1, and and make sure that each project does not indicate any errors.  I think it should in 7.2.1, because that's what I saw.  The upgrade to 7.3rc2 showed the same problem.  I will be out of access to the internet for the next week or so, after that, I might be able to get some time to try and create a reproduction of the issue, but I really think that it should just "not work".
Comment 7 greggwon 2013-03-07 23:05:18 UTC
Created attachment 132358 [details]
debugger console messages

Debugger Console messages
Comment 8 greggwon 2013-03-07 23:05:59 UTC
I am not having problems with the debugger not being able to pick the right source lines to associate with the line number that it is referring too.  For me, this clearly points out that it has "wrong" information about which class file is associated with this project.  I have attached an image of the IDE window, and the output in the debugger console to illustrate the problem.  This is having huge impact on me doing some debugging for a demo tomorrow.
Comment 9 greggwon 2013-03-07 23:09:04 UTC
Created attachment 132359 [details]
the editor window showing the lines not matching

An image of the editor window.  Correlate the lines that have breakpoints on them, vs the console log of what actions were allowed and not allowed.  The first 2 lines of the method are executable, yet I can not set a breakpoint.  The method entry is on the right line, and the comments/blank lines are correct. But the actual program statements do not correspond to the lines that the debugger believes it can set breakpoints on.
Comment 10 greggwon 2013-03-08 00:12:07 UTC
In the previous comment, I meant to say "I am now having problems with the debugger".  And this is with 7.2.1.