Bug 200547 - [1.5][compiler] Invalid ambiguous error when calling an overriden generic method with MULTIPLE bounds
Summary: [1.5][compiler] Invalid ambiguous error when calling an overriden generic met...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 09:27 EDT by Arvid Heise CLA
Modified: 2007-09-18 07:45 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Heise CLA 2007-08-20 09:27:07 EDT
This bug seems closely related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=100869.

If you extend the example through a second bound, the JDT would issue the error when invoking the method m:
The method m(Integer) is ambiguous for the type B.

javac 1.6.0 compiles it without errors or warnings. Note that the @Override annotation does not result in any warning or error in the JDT.

If you remove any of these two bounds or if A becomes an interface, the error would disappear. This error remains if A provides an implementation for m.

abstract class A {
    abstract <T extends Number & Comparable<T>> void m(T x);
}

class B extends A {
    @Override
    <T extends Number & Comparable<T>> void m(T x) {}
}

class C {
    public static void main(String[] args) {
        new B().m(new Integer(1));
    }
}
Comment 1 Kent Johnson CLA 2007-08-21 15:08:08 EDT
Added AmbiguousMethodTest 65

Released into HEAD for 3.4 M2

Released for 3.3.1
Comment 2 Philipe Mulet CLA 2007-08-29 06:24:53 EDT
+1 for 3.3.1
Comment 3 Maxime Daniel CLA 2007-09-03 08:41:02 EDT
Verified for 3.3.1 using build M20070831-2000.
Comment 4 Jerome Lanneluc CLA 2007-09-18 07:45:54 EDT
Verified for 3.4M2 using I20070917-1800