Bug 104551 - [1.5][compiler] Method override checks fail with raw subtype and type variable as type bound
Summary: [1.5][compiler] Method override checks fail with raw subtype and type variabl...
Status: VERIFIED FIXED
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.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-20 14:29 EDT by Markus Keller CLA
Modified: 2005-09-26 11:44 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 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