Bug 267088 - [1.5][compiler] Misleading error message in case of inherited methods
Summary: [1.5][compiler] Misleading error message in case of inherited methods
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-04 14:39 EST by Rémi Forax CLA
Modified: 2009-03-09 14:07 EDT (History)
0 users

See Also:


Attachments
Proposed patch and testcase (2.90 KB, patch)
2009-03-04 16:59 EST, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rémi Forax CLA 2009-03-04 14:39:49 EST
Build ID: I20090202-1535

Steps To Reproduce:
1. try the example, the error message is weird

interface I1 {
  I1 hello();
}

interface J1 {
  J1 hello(); 
}

class C1 implements I1, J1 {
  
}

Error Message:
The return types are incompatible for the inherited methods J1.hello(), I1.hello()

The error message is misleading because this example
compiles:

class C1 implements I1, J1 {
  public C1 hello() { ... }
}

Since Java 1.5, covariant return type are allowed.

This message is valid if the compiler is configure to use version 1.4 or 
if the two return types doesn't have any subtype. 

More information:
Comment 1 Kent Johnson CLA 2009-03-04 16:59:50 EST
Created attachment 127568 [details]
Proposed patch and testcase
Comment 2 Kent Johnson CLA 2009-03-05 11:46:59 EST
Fix and test released for 3.5M6
Comment 3 Frederic Fusier CLA 2009-03-09 14:07:48 EDT
Verified for 3.5M6 using I20090309-0100.

IMO, the initial message should not have been changed when the compliance was less than 1.5. But that's only my 2 cents...