Bug 89848 - [search] does not find method references in anonymous class of imported jarred plugin
Summary: [search] does not find method references in anonymous class of imported jarre...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-31 11:56 EST by Markus Keller CLA
Modified: 2005-04-01 13:11 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-03-31 11:56:15 EST
I20050331-0010

Search does not find method references in anonymous class of imported jarred plugin:

- new workspace
- import plugin 'org.eclipse.jface' as binary project
- open TextCellEditor, go to line 184, and select "focusLost" in the call
        "TextCellEditor.this.focusLost();" inside the anonymous FocusAdapter
- press Ctrl+Shift+G
=> no reference is found

This worked fine in 3.1M5a (where jface was not a jarred plugin). It's quite a
severe regression for those who want to work self-contained without PDE containers.
Comment 1 Frederic Fusier CLA 2005-04-01 06:46:16 EST
Search fails as this is the binary file which is processed instead of associated
source file.
I continue to investigate...
Comment 2 Frederic Fusier CLA 2005-04-01 07:02:18 EST
Jerome,

With M5, while getting Class File reader in MatchLocator, the root was a
JarPackageFragmentRoot (jface.jar [in org.eclipse.jface]) which was clearly
identified as an archive (root.isArchive() returns true).

However, with jarred plugin, the root is now a "simple" PackageFragmentRoot
(<project root> [in org.eclipse.jface]) which is not considered as an archive.
As root.isArchive() returns false on this root, we fail to look in zip file and
so we're missing attached source...

Is there anything simple to do to avoid this which could be put in M6?
Comment 3 Frederic Fusier CLA 2005-04-01 08:34:42 EST
It seems to come from MatchLocator.classFileReader(IType) which does not use
full path when root is not an archive.

Following lines:
if (!root.isArchive())
    return ClassFileReader.read(type.getPath().toOSString());

should have been written:
if (!root.isArchive())
    return ClassFileReader.read(type.getResource().getLocation().toOSString());

I've run all JDT/Core tests with this fix and everything is green...

I'll run also JDT/UI tests in case of and add a specific test for this bug. Then
I'll release the change for M6.
Comment 4 Frederic Fusier CLA 2005-04-01 10:07:05 EST
Fixed.

Described code change has been released in HEAD.
Comment 5 Frederic Fusier CLA 2005-04-01 10:07:53 EST
All JDT/UI tests (version v20050331-1200) are green.
Comment 6 Frederic Fusier CLA 2005-04-01 10:24:12 EST
Test case added in JavaSearchBugsTests.
Comment 7 Olivier Thomann CLA 2005-04-01 13:11:58 EST
Verified in I20050401-1205