| Summary: | [1.5][compiler] Compiler allowing invalid generic interface inheritance | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ian Graham <igraham> |
| Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | kent_johnson |
| Version: | 3.1 | ||
| Target Milestone: | 3.1 RC2 | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
The following illustrates the problem more simply, and should be illegal:
import java.util.*;
interface IntegerListIterator extends ListIterator<Integer>, Iterator {}
Suspect the raw type is tolerated by mistake. Interestingly we correctly catch this error case:
interface Foo<T> {}
class XSuper implements Foo {}
public class X extends XSuper implements Foo<Integer> {}
Problem only occurs when checking interfaces. Problem comes from the fact that when resolving superinterfaces, the source type isn't yet connected to its direct superinterfaces. Thus it is missing part of the types to check. These obtained through superclass are fine. Added GenericTypeTest#test719. Fixed Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD Verified for 3.1 RC2 using build I20050610-0010 |
The following code causes an error in Sun's javac, but Eclipse 3.1RC1 is allowing it. The problem is that for IntegerListIterator declaration to be valid, the IntegerIterator should be required to extend Iterator<Integer> as well. import java.util.Iterator; import java.util.ListIterator; interface IntegerIterator extends Iterator { public abstract int nextInt(); } interface IntegerListIterator extends ListIterator<Integer>, IntegerIterator { public abstract int previousInt(); }