Bug 346039 - [1.5][compiler] ecj vs. javac differ for varargs overloading
Summary: [1.5][compiler] ecj vs. javac differ for varargs overloading
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 96330 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-17 03:33 EDT by Ayushman Jain CLA
Modified: 2011-12-06 06:17 EST (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 Ayushman Jain CLA 2011-05-17 03:33:49 EDT
The following fails to compile with build I20110514-0800

class Test implements IClass{

    Test(IClass c, Test t, IType... args) {}
    Test(IClass c, IType... args) {}

    public static void main(String args[]) {
        IClass c = null;
        Test t = null;

        Test t2 = new Test(c, t);     // incorrectly flagged ambiguous
    }

}

interface IType{}
interface IClass extends IType{}

ECJ is consistent with javac 5,6 but not with javac7b138. This was fixed in javac bug http://bugs.sun.com/view_bug.do?bug_id=5088429.
Comment 1 Olivier Thomann CLA 2011-05-17 08:42:35 EDT
I would target 3.7.1 to match the Java 7 behavior when the Java 7 support is released.
Comment 2 Srikanth Sankaran CLA 2011-05-24 20:28:04 EDT
*** Bug 96330 has been marked as a duplicate of this bug. ***
Comment 3 Srikanth Sankaran CLA 2011-08-04 00:23:20 EDT
Don't expect to get to this before 3.8. Retargetting.
Comment 4 Nico CLA 2011-10-28 04:24:32 EDT
Also see this Stackoverflow thread for more details from people who know more about this than me:

http://stackoverflow.com/q/7918134/623612
Comment 5 Nico CLA 2011-10-28 04:25:45 EDT
(In reply to comment #4)
> Also see this Stackoverflow thread for more details from people who know more
> about this than me:
> 
> http://stackoverflow.com/q/7918134/623612

Posted on the wrong bug, sorry.
Comment 6 Srikanth Sankaran CLA 2011-11-17 01:12:18 EST
(In reply to comment #0)

> javac bug http://bugs.sun.com/view_bug.do?bug_id=5088429.

Just a note that the "Interesting corner case:" cited in
the page above continues to elicit an ambiguous call error.
So does the following snippet:


public class X {
	public static void main(String[] s) {
		count(1);
		count(1, 1);
		count(1, 1, 1);
	}
	public static void count(int ... values) {}
	public static void count(int i, int ... values) {}
}
Comment 7 Srikanth Sankaran CLA 2011-11-17 07:30:23 EST
Combined fix and tests for bug 346039 and bug 346038 have been released into
3.8 stream via 85f48e0f08275e1f81e9995073d5c4f69bfd0707.

Some existing tests had to be remastered - in all instances the behavior
matches JDK 7b147 behavior.
Comment 8 Jay Arthanareeswaran CLA 2011-12-06 06:17:04 EST
Verified for 3.8M4 with build I20111204-2000.