Bug 73609 - Code completion stops with generics & casting
Summary: Code completion stops with generics & casting
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-09 16:11 EDT by Roger Nye CLA
Modified: 2004-10-27 07:01 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roger Nye CLA 2004-09-09 16:11:32 EDT
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
Comment 1 David Audel CLA 2004-09-10 10:29:38 EDT
I cannot reproduce the problem.

Roger - What is your Eclipse build number ?
Comment 2 David Audel CLA 2004-09-13 06:18:33 EDT
From: roger_nye@bluewin.ch

  I am using the release of 3.0.0 build id: 200406251208.
Comment 3 David Audel CLA 2004-09-13 06:24:15 EDT
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.