Bug 87157

Summary: Compilation problems on type covariance
Product: [Eclipse Project] JDT Reporter: NeXTWare <info>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: minor    
Priority: P3 CC: fraenkel
Version: 3.1   
Target Milestone: 3.1 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test source code none

Description NeXTWare CLA 2005-03-04 11:47:59 EST
On eclipse 3.1M4 following code in Java 1.5 generates a runtime error

-----------------------
public interface Interface {
    Number getValue();
}
-----------------------
public class C1 {
    public Double getValue() {
        return Math.random();
    }
}
-----------------------
public class C2 extends C1 implements Interface{
    public static void main(String[] args) {
        Interface i=new C2();
        System.out.println(i.getValue());
    }
}

execution produces

Exception in thread "main" java.lang.AbstractMethodError:
C2.getValue()Ljava/lang/Number;
	at C2.main(C2.java:12)

but run normally when compiled by Sun JavaC
Comment 1 NeXTWare CLA 2005-03-04 11:50:00 EST
Created attachment 18465 [details]
Test source code
Comment 2 Michael Fraenkel CLA 2005-03-04 16:45:34 EST
Works with 3.1M5a.
Comment 3 Philipe Mulet CLA 2005-03-07 05:45:56 EST
Indeed, works fine in latest.
Added MethodVerifyTest#test047.