Bug 267088

Summary: [1.5][compiler] Misleading error message in case of inherited methods
Product: [Eclipse Project] JDT Reporter: Rémi Forax <forax>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.5   
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed patch and testcase none

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...