Bug 81556

Summary: [search] correct results are missing in java search
Product: [Eclipse Project] JDT Reporter: Genady Beryozkin <eclipse>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Genady Beryozkin CLA 2004-12-17 14:38:37 EST
I have a little complex scenario in which search for references fails.

I have some source files in a java project. These source files along with 
other files are compiled outside Eclipse (because they use preprocessor) into 
a jar file. The jar file is then added to the project as "external jar file" 
library. Some of the source files in the project depend on (e.g., extend) 
classes that are only found in the jar file.
(This poses a small bootstrapping problem, which requires me to initially 
generate the jar file outside eclipse). This also means that the same class 
appears both as source file and packaged into a jar file.

The problem is as follows:
I have class "jar_only.ExternalClass" that extends "source.MyClass" (that is 
an external class extends my source class)
Another class "source.UtilityClass" calls a final method "coolMethod" on a 
variable of type "jar_only.ExternalClass" while the method is defined 
in "source.MyClass".

When I try to search for all references to this method, no results are 
displayed (i.e, 0 references found). However, when I 
open "source.UtilityClass" and press "F3" on the method invocation, the 
correct file is opened (that is source.MyClass) and the correct method is 
selected.

The behavior is consistent and reproducible.
Comment 1 Frederic Fusier CLA 2004-12-20 04:18:32 EST
Would it possible that you zip your project and attach it to this bug?
Thanks
Comment 2 Frederic Fusier CLA 2004-12-28 10:34:11 EST
It seems that it's a ClasspathSourceDirectory issue.
There's a Plan.java in excluded org/mmtk/vm folder of source folder src which
have SemiSpace as superclass. While resolve import of Plan, method
findClass(String, String, String) of ClasspathSourceDirectory class does not
skip excluded folder while getting file.
Superclasses hierarchy of Plan is invalid and that's explain why Search cannot
find correct references.
Jerome, I'll send you all necessary files to reproduce the problem...
Comment 3 Jerome Lanneluc CLA 2005-01-03 10:32:13 EST
Created attachment 16897 [details]
Proposed patch

I was able to reproduce. Indeed the exclusion pattern was not taken into
account. Attached is a proposed fix.
Comment 4 Jerome Lanneluc CLA 2005-01-03 10:33:39 EST
Moving back to Frederic to add a regression test.
Comment 5 Frederic Fusier CLA 2005-01-04 10:16:55 EST
Released in HEAD.

Test case added in JavaSearchBugsTests
Comment 6 David Audel CLA 2005-02-15 05:59:42 EST
Verifid in I20050214-0927 for 3.1M5