Bug 81757

Summary: [1.5] Problem compiling Iterator<T>
Product: [Eclipse Project] JDT Reporter: clifford lyon <cplyon928>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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