Bug 87157 - Compilation problems on type covariance
Summary: Compilation problems on type covariance
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.1 M6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-04 11:47 EST by NeXTWare CLA
Modified: 2005-03-07 05:45 EST (History)
1 user (show)

See Also:


Attachments
Test source code (818 bytes, application/octet-stream)
2005-03-04 11:50 EST, NeXTWare CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.