Community
Participate
Working Groups
Using 20030330-0500, I have a java project set as 1.5 compliance and using a 1.5 JDK. I have the following code: import java.awt.Frame; import java.awt.event.WindowAdapter; public class Foo extends Frame { public void bar() { addWindowListener(new WindowAdapter()); } } I select WindowAdapter in new WindowAdapter() and press F3. I got two proposals that are identical. I would expect only one.
Created attachment 19355 [details] Screenshot
Also once I cancel the dialog, I got a bip and a message in the status bar that says: "Current text selection does not resolve to a Java element". I don't expect this error.
JDT/Core reports two different Java elements in this case from ICodeAssist#codeSelect. I have opened bug 89631 for the beep when the dialog get canceled.
I might expect two entries because I have JDK1.4.2 and 1.5.0 in the workspace. But I don't expect the entry to be displayed with the same label. If you use Ctrl + Shift + T, and type WindowAdapter, the right two entries are displayed.
This seems to be a problem in the Java model. Simple test case: 1) Create a java project 2) Create a package fragment pack in which you had the following CU: package pack; import pack.*; public class A { } 3) Select pack in the package declaration and press F3. 4) You end up with a dialog with two identical entries in it. Put a breakpoint: org.eclipse.jdt.internal.core.SelectionRequestor line 374 IPackageFragment[] pkgs = this.nameLookup.findPackageFragments(new String(packageName), false); There are two package fragments returned from that call. I would expect only one. This could lead to different kinds of problems (memory consumption, duplicates in multiple dialogs). Raise severity as major. Jérôme, any idea what could be wrong?
Namelookup is adding the package of the working copy a second time. Note problem existed in 3.1 M5a
Created attachment 19379 [details] Proposed patch
Need to check performance before releasing this patch.
+1 for M6
Created attachment 19395 [details] Patch with time tracing
Not a regression comparing to 3.1 M5. Will fix in 3.1 M7.
Released patch and added regression test NameLookupTests2#testFingPackageFragementWithWorkingCopy()
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.