Bug 81757 - [1.5] Problem compiling Iterator<T>
Summary: [1.5] Problem compiling Iterator<T>
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-21 16:20 EST by clifford lyon CLA
Modified: 2005-01-04 05:31 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description clifford lyon CLA 2004-12-21 16:20:15 EST
Using:

 Version: 3.1.0
 Build id: 200412162000

I'm trying to build an Iterator<T> using 1.5 generics, but the compiler seems to
think the return type "E" from the Iterator interface is a real type.

Example:

import java.util.Iterator;
public class MyStringIterator implements Iterator<String> {
    public boolean hasNext() { return false; }
    public String next() { return null; }
    public void remove() {}
}

Gives two errors:

+ The type MyStringIterator must implement the inherited abstract method
Iterator.next()   

+ E cannot be resolved to a type

I also get this from the mouseover on "String next()":

Type safety: The return type String of the method next() of type
MyStringIterator needs unchecked conversion to conform to the return type E of
inherited method

So far, rest of the generics stuff has worked fine.
Comment 1 Philipe Mulet CLA 2005-01-04 05:30:59 EST
Cannot reproduce any longer in latest.
Code compiles clear now.

Added regression test: GenericTypeTest#test443.
Comment 2 Philipe Mulet CLA 2005-01-04 05:31:17 EST
Works for me