Bug 81571 - Autoboxing ambiguousy
Summary: Autoboxing ambiguousy
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-17 17:49 EST by Mads Andersen CLA
Modified: 2005-02-15 12:59 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mads Andersen CLA 2004-12-17 17:49:16 EST
Here's an example that compiles with javac, but fails with the Eclipse compiler:

---8<---
package a;

public class A {

    public void a(int a, int b) {
    }

    public void a(Object a, Object b) {
    }

    public void b() {
        Integer i = 1;
        a(i, 2);
    }
}
---8<---

The error reported by Eclipse is:

The method a(int, int) is ambiguous for the type A
Comment 1 Kent Johnson CLA 2005-01-05 16:34:52 EST
Added Autoboxing test073
Comment 2 Kent Johnson CLA 2005-01-06 11:06:48 EST
Just tried with the latest javac 1.5.0_01 drop & our original behaviour was 
correct.

The message send should be ambiguous since the exact match after autoboxing 
does not take precedence over other compatible matches.

Reverted back to our original behaviour.
Comment 3 David Audel CLA 2005-02-15 12:59:14 EST
Verified in I20050214-0927