Bug 69626 - [1.5] The return type is incompatible
Summary: [1.5] The return type is incompatible
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 70098 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-07-08 11:28 EDT by Igor Fedorenko CLA
Modified: 2005-01-11 11:02 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedorenko CLA 2004-07-08 11:28:03 EDT
The following code compiles with javac (as of SUN 1.5.0 beta3 build 57) but not
by  cheetah (from CVS as of few minutes ago). Note that this is 100% valid java
1.4 code and this is how this bug is different from bug 58903

====================================
package test.cheetah;
public class IncompatibleReturnType extends java.util.ArrayList {
    public Object[] toArray(Object[] a) {
        return super.toArray(a);
    }
}
====================================
Comment 1 Philipe Mulet CLA 2004-07-09 18:06:50 EDT
Problem is in method verifier, method is claimed to be not compatible with
super method: public <T> T[] toArray(T[] a)
Comment 2 Philipe Mulet CLA 2004-07-09 18:08:51 EDT
Note that if defining original type as:
package test.cheetah;
public class IncompatibleReturnType extends java.util.ArrayList<Object> {
    public Object[] toArray(Object[] a) {
        return super.toArray(a);
    }
}

then a name clash would be signalled. 
The fact a raw type is used means that all type parameters are erased as well 
from generic methods.
Comment 3 Philipe Mulet CLA 2004-07-18 04:47:25 EDT
*** Bug 70098 has been marked as a duplicate of this bug. ***
Comment 4 Philipe Mulet CLA 2004-07-18 04:48:05 EDT
Released changes to erase generic method type parameters on raw types.
Comment 5 Kent Johnson CLA 2004-07-21 16:03:08 EDT
Fixed in Head.


test149