Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356742

Summary: [Xtend] Varargs method call with overloaded non-varargs method is broken
Product: [Modeling] TMF Reporter: Ingo Meyer <ingo.meyer>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: sebastian.zarnekow, sven.efftinge
Version: unspecifiedFlags: sven.efftinge: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ingo Meyer CLA 2011-09-05 12:31:15 EDT
Build Identifier: 20110609-2236

When calling a method with a varargs parameter which itself is overloaded with a method without varargs it will give the error "Invalid number of arguments. Expected (String)" in an Xtend editor.

This is since a nightly build after 2.0.1 stable. I currently tested with 2.0.1.v201109050027

Reproducible: Always

Steps to Reproduce:
1. Use this class

public class VarargsTest {

	public static final VarargsTest LOG = new VarargsTest();

	public String info (String msg) {
		return msg;
	}

	public String info (String msg, Object... args) {
		return MessageFormat.format( msg, args );
	}
	
	public static void main(String[] args) {
				
		String a = VarargsTest.LOG.info("hello world");
		String b = VarargsTest.LOG.info("hello {0}","world");
		
		System.out.println(a);
		System.out.println(b);
	}	
}

2. Try to use it in any Xtend class via inject or static access

	@Inject extension VarargsTest varargsTest

	varargsTest.info('hello {0}','world')
	VarargsTest::LOG.info('hello {0}','world')

3. Failes with validation error "Invalid number of arguments. Expected (String)"
Comment 1 Sebastian Zarnekow CLA 2011-10-12 09:22:58 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 17:27:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:39:03 EDT
Closing all bugs that were set to RESOLVED before Neon.0