Bug 104551

Summary: [1.5][compiler] Method override checks fail with raw subtype and type variable as type bound
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-07-20 14:29:14 EDT
I20050627-1435 (3.1)

Method override checks fail with raw subtype and type variable as type bound.
Javac accepts these classes, which is IMO correct.

interface IStructuredContentProvider<I, E extends I> {
    public E[] getElements(I inputElement);
    public E[] getChildren(E parent);
}

class MyContentProvider implements IStructuredContentProvider {
// eclipse error: The type MyContentProvider must implement the inherited
// abstract method IStructuredContentProvider.getChildren(I)

    public Object[] getElements(Object inputElement) {
        // eclipse error: The return type is incompatible with
        // IStructuredContentProvider.getElements(Object)
        return null;
    }

    public Object[] getChildren(Object parent) {
        // eclipse error: Name clash: The method getChildren(Object) of type
        // MyContentProvider has the same erasure as getChildren(E) of type
        // IStructuredContentProvider<I,E> but does not override it
        return null;
    }
}
Comment 1 Philipe Mulet CLA 2005-07-21 09:07:23 EDT
Raw type binding should use formal parameter bound erasures instead of their
upper bound (i.e. E --> Object, and not I).

Added MethodVerifyTest#test063-064
Comment 2 Philipe Mulet CLA 2005-07-21 09:07:44 EDT
Fixed
Comment 3 Olivier Thomann CLA 2005-08-09 11:50:10 EDT
Verified for 3.2M1 (I20050808-2000)
Comment 4 David Audel CLA 2005-09-26 11:44:57 EDT
Verified using M20050923-1430 for 3.1.1