Bug 169970 - [model] code assist favorites must honour build path of project in context
Summary: [model] code assist favorites must honour build path of project in context
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 170249 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-09 10:21 EST by Dani Megert CLA
Modified: 2007-09-18 05:21 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix and regression test (3.19 KB, patch)
2007-08-13 10:32 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-01-09 10:21:58 EST
N20070108-0010

Have this:

1. in project S add to package 'packS':
   public class Stat {
      public static void testMethod() {
      }
   }

2. hack the following code into your CompletionRequestor:
   yourRequestor.setFavoriteReferences(new String[] { "packS.Stat.*" });

3. in project P with package 'packP':
   public class Foo {
      void foo() {
         t<code assist>
      }
   }
==> suggests 'testMethod' which it shouldn't applying this would cause a compilation error because type packS.Stat isn't on the build path of project P.
Comment 1 David Audel CLA 2007-01-10 12:03:10 EST
I can reproduce the problem only if Stat.java is opened in a editor.
When the editor is closed 'testMethod' isn't proposed.

The problem seems to be in NameLookup. The workingcopies given to build the NameLookup aren't filtered if they are not on the buildpath of the project.

I can reproduce a similar behavior with the following test case.

1) create a project P1
2) create p1/X.java inside P1
package p1;
public class X {}

3) create a project P2
4) create p2/Y.java inside P2
package p2;
import p1| // complete at | location
public class Y {
}
5) do ctrl+space at | location

if X.java is opened in an editor p1 is proposed.
if X.java isn't opened in an editor p1 isn't proposed.

Comment 2 Frederic Fusier CLA 2007-01-12 03:24:14 EST
*** Bug 170249 has been marked as a duplicate of this bug. ***
Comment 3 Jerome Lanneluc CLA 2007-06-19 10:49:34 EDT
NameLookup constructor should filter out working copies that don't belong to the project
Comment 4 Jerome Lanneluc CLA 2007-06-26 09:22:34 EDT
See also bug 194399
Comment 5 Jerome Lanneluc CLA 2007-08-13 10:32:44 EDT
Created attachment 75957 [details]
Proposed fix and regression test
Comment 6 Jerome Lanneluc CLA 2007-08-14 04:25:19 EDT
Fix and test released for 3.4M2 in HEAD.
Comment 7 Frederic Fusier CLA 2007-09-18 05:21:05 EDT
Verified for 3.4 M2 using I20070917-0010.