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

Bug 347656

Summary: Issue with Xtend2 ListExtensions
Product: [Modeling] TMF Reporter: Joel Denton <joeldenton>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jan, sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch to rsolve type argument jan: review+

Description Joel Denton CLA 2011-05-30 10:06:36 EDT
Build Identifier: Xtend2 SDK	2.0.0.v201105271731

Using Xtend2, the following line:

'foo,bar,baz'.split(',').reverse().join(',')

generates the following Java code:

String[] _split = "foo,bar,baz".split(",");
List<String> _reverse = ListExtensions.<Object>reverse(((List<String>)Conversions.doWrapArray(_split)));
String _join = IterableExtensions.join(_reverse, ",");
return _join;

with exception: The parameterized method <Object>reverse(List<Object>) of type ListExtensions is not applicable for the arguments (List<String>).

Curent workaround is to split into multiple expressions:
var z = 'foo,bar,baz'.split(',').reverse()
z.join(',')


Reproducible: Always

Steps to Reproduce:
1. In Xtend file:  'foo,bar,baz'.split(',').reverse().join(',')
2. Error in generated Java
Comment 1 Sebastian Zarnekow CLA 2011-05-30 10:11:35 EDT
Scheduled for SR1.
Comment 2 Jan Koehnlein CLA 2011-07-06 10:50:31 EDT
Created attachment 199187 [details]
Patch to rsolve type argument
Comment 3 Jan Koehnlein CLA 2011-07-06 10:51:28 EDT
Please revise the patch: The component type of the array returned by String.split() is not used to resolve the tapeArgument in the call to reverse().
Comment 4 Sebastian Zarnekow CLA 2011-07-06 11:51:02 EDT
Patch looks good to me. Could you add a test case, too?
Comment 5 Jan Koehnlein CLA 2011-07-07 04:14:28 EDT
Patch and test pushed to master.
Comment 6 Karsten Thoms CLA 2017-09-19 17:37:32 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:48:35 EDT
Closing all bugs that were set to RESOLVED before Neon.0