Summary: | Code completion stops with generics & casting | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Roger Nye <roger> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.0 | ||
Target Milestone: | 3.1 M2 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
I cannot reproduce the problem. Roger - What is your Eclipse build number ? From: roger_nye@bluewin.ch I am using the release of 3.0.0 build id: 200406251208. This build is a 3.0 build and does not support java 1.5. The problem does not exist with the latest build I20040907. I close this bug. Do not hesitate to reopen this bug if you can reproduce the problem. |
I was typing in the Java editor when code completion stopped working, instead it gave a status bar message "No completions available". It still worked in other files and it seems it is related to what I was entering (although no errors were shown). Code completion stopped for variables, methods and types, so the following did nothing (~ indicates Ctrl + SPACE pressed) Str~ String name; nam~ name.~ It seems to be related to generics. In the following code, the only difference between working and non-working code are the lines with generics: The following code gives "No completions available" when edited public class TestCompletion { public static void unpack(String project) { ZipFile file; try { file = new ZipFile(project); Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) file.entries(); // >>>> generics here while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); // >>>> no cast here String name = entry.getName(); } } catch (Exception e) { e.printStackTrace(); } } } //---------------------------------------------------------------------------- and for this version code completion works: public class TestCompletion { public static void unpack(String project) { ZipFile file; try { file = new ZipFile(project); Enumeration entries = file.entries(); // >>>> no generics here while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry)entries.nextElement (); // >>>> cast here String name = entry.getName(); } } catch (Exception e) { e.printStackTrace(); } } } //----------------------------------------------------------------------------- It is also something about the cast, because if I replace the Zip classes with Jar classes and remove the cast on the entries, code completion keeps working. Good luck. Roger