Bug 95933 - Refining a generic method causes AbstractMethodError
Summary: Refining a generic method causes AbstractMethodError
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-19 09:02 EDT by baikuo21 CLA
Modified: 2005-05-27 09:05 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 baikuo21 CLA 2005-05-19 09:02:18 EDT
3.1M7

for example:

interface A<T> {
    void f(T x);
}

interface B extends A<String> {
    void f(String x);
}

class C implements B {
    public void f(String x) {
    }
}

and then,

A a = new C();
a.f(new Object());

Compiler these codes by javac, and we get a ClassCastException.
But by eclipse, there is an AbstractMethodError.
The compiler of eclipse must generate a brigde method with name f and type
(Ljava/lang/Object;)V .
Comment 1 baikuo21 CLA 2005-05-19 09:15:10 EDT
Change C to:

class C implements B {
    public void f(String x) {
    }
    public void f(Object x) {
    }
}

then no Throwable is thrown at running for eclipse compiler
but this code is denied in sun's javac
Comment 2 Kent Johnson CLA 2005-05-24 13:21:44 EDT
Added MethodVerify test055
Comment 3 Maxime Daniel CLA 2005-05-27 07:55:23 EDT
Verified on build I20050527-0010.