Bug 69626

Summary: [1.5] The return type is incompatible
Product: [Eclipse Project] JDT Reporter: Igor Fedorenko <igor>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: johan.walles
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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