Bug 102631 - [1.5][compiler] false java error for ambiguous methods
Summary: [1.5][compiler] false java error for ambiguous methods
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: 3.1.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-04 05:13 EDT by Ralf Canis CLA
Modified: 2005-09-26 11:08 EDT (History)
1 user (show)

See Also:


Attachments

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