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.
Double clicking on the Java class or its member in the explorer or selecting the "Next compilation error" icon on the tool bar results in the second copy of the same class opened and positioned in the editor. Problem appeared in the devbuild 200401051900 and is intermittent.
I tried to reproduce a described bug in the current dev build (200401141900), but I was unsuccessful. I am marking the issue 'worksforme'. If you encountered issue in the recent builds again, feel free to reopen it.
This issue is 100% reproducible with a caveat - bad arrangement of mounted file systems. My directory structure is /apps/myproject/src/com/myclass.java. It turns out I had CVS FS's mounted in the following order: /apps/myproject and then it's relative subdirectory src. The /apps/myproject was set to NOT participate in execution, compilation, debugging and documentation and src providing correct classpath was set to be included in compilation and debugging. Nevertheless, IDE was grabbing the myclass.java from the first FS ignoring those settings. How to reproduce: using build 200401141900 open myclass.java in the editor making sure it is selected from the second FS in the explorer, make deliberate syntax error, compile it and get errors in the output window and then hit Next Error in the toolbar - bingo, editor opens the second copy of the myclass.java. (Caveat - I use Indirect Ant Compilation, maybe that contributes to the confusion too). How to circumvent: swap order of mounted filesystems: put src first and /apps/myproject second and the problem disappears. Now IDE consistently returns to the original myclass.java window. I don't know how to properly classify this problem, but it should be kept open in the low priority to provide a test case when the whole FS and mounting and projects mechanism is revisited. Kudos for creating such a great tool!
Hmm, I can only reproduce it in the case I first open the file through the non-classpath-matching-root filesystem. If you open your source file through the correct filesystem (the one, for which root=classpath entry, i.e. "/apps/myproject/src/"), it will then always work regardless of the order of filesystems. It is impossible to fix the problem with current design, because the files are actually different to the IDE (the IDE doesn't know they both represent the same file). The IDE always tries to open a file matching package structure. The 4.0 project impl won't lead you to overlapping mounts, so it would be non-issue then (this problem is known for a long time and was already considered for next projects implementation).
verified