Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356742 - [Xtend] Varargs method call with overloaded non-varargs method is broken
Summary: [Xtend] Varargs method call with overloaded non-varargs method is broken
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-05 12:31 EDT by Ingo Meyer CLA
Modified: 2017-09-19 17:39 EDT (History)
2 users (show)

See Also:
sven.efftinge: indigo+


Attachments

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