Bug 72524 - [1.5] Potential problem with covariance error message
Summary: [1.5] Potential problem with covariance error message
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-24 13:53 EDT by Marco Qualizza CLA
Modified: 2004-08-27 13:14 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 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.