Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347656 - Issue with Xtend2 ListExtensions
Summary: Issue with Xtend2 ListExtensions
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-30 10:06 EDT by Joel Denton CLA
Modified: 2017-09-19 17:48 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
Patch to rsolve type argument (1.59 KB, patch)
2011-07-06 10:50 EDT, Jan Koehnlein CLA
jan: review+
Details | Diff

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