Bug 102631

Summary: [1.5][compiler] false java error for ambiguous methods
Product: [Eclipse Project] JDT Reporter: Ralf Canis <ralf-eclipse>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: mlists
Version: 3.1   
Target Milestone: 3.1.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ralf Canis CLA 2005-07-04 05:13:01 EDT
The following code does not compile due to two FALSE errors:
"The method f(boolean, Object[]) is ambiguous for the type BugTest"

Works with the original Sun javac command line compiler, inside NetBeans and
IDEA but not with Eclipse (pre 3.1 and released 3.1).

public class BugTest {
    void f(boolean b, Object... o) {
        System.err.println("f(boolean, Object...) called");
    }

    void f(Object... o) {
        System.err.println("f(Object...) called");
    }

    public static void main(String[] args) {
        BugTest a = new BugTest();
        a.f(true);
        a.f(true, "foobar");
        a.f("foo", "bar");
    }
}
Comment 1 Philipe Mulet CLA 2005-07-04 05:26:39 EDT
NetBeans and IDEA both uses javac compiler; so these are all the same comparison
point.

Need to investigate a fix for 3.1.1
Comment 2 Philipe Mulet CLA 2005-07-04 07:49:13 EDT
Added VarargsTest#test033.

Looks like an issue during tiebreak. f(boolean,Object...) should be preferred
over f(Object...) for invocations with leading boolean argument.
Comment 3 Kent Johnson CLA 2005-09-19 13:22:38 EDT
fixed & released in 3.1.1 stream
Comment 4 Kent Johnson CLA 2005-09-19 14:53:45 EDT
released in 3.2 HEAD stream
Comment 5 Maxime Daniel CLA 2005-09-21 10:03:51 EDT
Verified for 3.2 M2 with build I20050920-0010.
Comment 6 Olivier Thomann CLA 2005-09-26 11:08:01 EDT
Verified for 3.1.1 using M20050923-1430.Verified for 3.1.1 using M20050923-1430.