Bug 72524

Summary: [1.5] Potential problem with covariance error message
Product: [Eclipse Project] JDT Reporter: Marco Qualizza <mlq.eclipse>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marco Qualizza CLA 2004-08-24 13:53:11 EDT
I'm only reporting this because covariant return type support was reported for
the I20040727 build...  I apologize if this is a known issue (I couldn't find a
bug report for it...)

This is not allowed, although it should be (afaik):

public ListWriter extends Writer {
   ...
   public void append(char ch) { ...
   ...
}

The error reported is "The return type is incompatible with Writer.append(char)."

Eclipse I20040824 GTK
Comment 1 Marco Qualizza CLA 2004-08-24 16:13:39 EDT
I've misunderstood some of the fundamentals of covariant return types.  If there
is an issue, it might be the nature of the error message (it lead me to believe
that what I was doing was ok, when, afaik, void can not be a specialization of
anything).  Modifying summary to reflect.
Comment 2 Kent Johnson CLA 2004-08-25 12:25:11 EDT
The purpose of the error message is let you know that you're overriding an 
inherited method in an incompatible way.

It seems obvious to me, but maybe you could suggest something different?
Comment 3 Marco Qualizza CLA 2004-08-25 13:02:38 EDT
Would "'void' is not a valid covariant type." be too lame?
Comment 4 Kent Johnson CLA 2004-08-25 13:09:27 EDT
I'm not convinced we need to make a special case out of 'void'.

Plus we don't want to lose the fact that you're overriding an inherited method.
Comment 5 Kent Johnson CLA 2004-08-27 13:14:30 EDT
I think we will leave the error message as is.