Bug 35755

Summary: Search in hierarchy misses dependent projects
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: 2.1   
Target Milestone: 2.1.1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
MatchLocator2 patch
none
Regression test testHierarchyScope3(). none

Description Jerome Lanneluc CLA 2003-03-27 10:03:52 EST
Build I20030325

1. In self-hosting workspace, open PlatformObject in org.eclipse.core.runtime
2. In Outline, select getAdapter(Class)
3. Search in hierarchy
Observe: No matches are found, but there are some (e.g. in 
org.eclipse.debug.internal.core.RuntimeProcess.getAdapter(Class)).
Comment 1 Philipe Mulet CLA 2003-03-27 10:23:49 EST
Not critical, just search in workspace instead.
Comment 2 Jerome Lanneluc CLA 2003-03-28 07:20:17 EST
Created attachment 4378 [details]
MatchLocator2 patch

Fixed by resolving in the context of the focus project only potential matches
that are in a prereq project of the focus project. Other potential matches are
resolved in the context of their respective projects.
Comment 3 Jerome Lanneluc CLA 2003-03-28 07:21:43 EST
Created attachment 4379 [details]
Regression test testHierarchyScope3().
Comment 4 Philipe Mulet CLA 2003-03-28 07:58:08 EST
I suspect each match should rather always be resolved in its defining context, 
with some knowledge of type hierarchy.

e.g. 
P0 defines type X
  public class X { 
     public static X TheX;
     public void foo(){}
  }
P1 prereqs P0 and defines type T 
  public class T { 
     public X zork(){ 
        return X.TheX; 
     }
  }

P2 prereqs P0 and P1, and defines Y
  public class Y extends X {
     public void bar() {
       new T().zork().foo();  
     }
  }

P3 prereqs P2, and defines Z
   public class Z extends Y {
     static {
       X.TheX = new Z(); // zork() will actually answer an instance of Z
     }
     public void foo() {} // refs should find one in Y.bar()
   }
Comment 5 Philipe Mulet CLA 2003-04-02 06:32:14 EST
Reopen
Comment 6 Philipe Mulet CLA 2003-04-02 06:33:29 EST
May also want to backport into 2.1 future patch
Comment 7 Jerome Lanneluc CLA 2003-04-15 06:08:47 EDT
Each potential match is now resolved in the context of its project. If the 
focus type is not visible from this project, then its super type names are used 
(instead of the bindings).

Added regression tests JavaSearchMultipleProjectsTests.testHierarchyScope3() 
and testHierarchyScope4().

Fix and tests backported to the 2.1 maintenance stream.
Comment 8 Jerome Lanneluc CLA 2003-04-15 10:46:16 EDT
Fixed in 2.2 stream as well.
Comment 9 David Audel CLA 2003-06-02 06:50:34 EDT
Verified.
Comment 10 David Audel CLA 2003-06-10 10:21:36 EDT
Verified for 3.0M1.