Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328136

Summary: [navigation] Open Declaration on linked source
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.6Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marvin Fröhlich CLA 2010-10-19 11:05:01 EDT
Build Identifier: 20100617-1415

If I put the caret on a method name and press F3 (Open Declaration) and the method implementation is not in my workspace, but an archived source file, the source file is opened just as if it was a .java file in my workspace, but labled MyClass.class.

So far so good. If I press F3 on a method name inside of this opened file, which's implementation is in the very same file, the caret doesn't simply jump to the method, but the file is opened again in a new tab.

Reproducible: Always
Comment 1 Dani Megert CLA 2010-10-20 03:34:00 EDT
> but an archived source file
What is an "archived source file"? Can you please give more detailed steps and/or explain your setup in more details.
Comment 2 Markus Keller CLA 2010-10-20 04:51:11 EDT
Just a guess: This can happen if there are nested types in a .java file. These are compiled into different .class files, and each of these class files opens in a separate editor (but all these editors show the whole source file).
Comment 3 Marvin Fröhlich CLA 2010-10-20 07:32:54 EDT
A very common example:

If I open the declaration on a JDK class method I need to place the src.zip file of the Java source into the JRE folder. Source files from this src.zip file are, what I called "archived source file"s.

And it happens on the major class'es methods as well (major class is the class defined directly in the file, not a nested one).

Do you need more info?
Comment 4 Dani Megert CLA 2010-10-20 09:53:25 EDT
This looks like what Markus described in comment 2 and this won't change.
Comment 5 Marvin Fröhlich CLA 2010-10-21 04:59:42 EDT
No, it's not, even if it looks like it ;).

Despite the very common example, I posted above, this also happens when you create a project A, write some code, pack it to a.jar file, include a.jar file in another project B and set the Source Location of imported a.jar in the Java Build Path properties of project B to the project A. Or you put .java (source) files into the jar next to the .class files. It's the same effect.

And in all three cases it has nothing to do with nested classes.
Comment 6 Dani Megert CLA 2010-10-21 05:04:20 EDT
Sorry, "it" works for me using http://download.eclipse.org/eclipse/downloads/drops/I20101019-0800/index.php.

Can't you just attach a sample workspace that shows the problem? Maybe I'm doing one step differently than you do.
Comment 7 Marvin Fröhlich CLA 2010-10-21 05:41:24 EDT
I just tried to create a sample workspace. But it actually worked there. I will report back when I have something to show you.
Comment 8 Dani Megert CLA 2010-10-21 05:43:58 EDT
>I just tried to create a sample workspace. But it actually worked there.
Maybe it's your workspace or additional bundles? Your bug 327904 also seems to suffer from some "special" setup.
Comment 9 Dani Megert CLA 2010-10-25 03:23:46 EDT
.