Bug 488449 - Type mismatch for map function returning strings
Summary: Type mismatch for map function returning strings
Status: REOPENED
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.9.1   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 06:23 EST by Miro Spönemann CLA
Modified: 2016-09-14 13:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miro Spönemann CLA 2016-02-25 06:23:31 EST
class Test {
    def test() {
        val List<Integer> list = newArrayList
        list += 'foo'.split(',').map[trim]
    }
}

This code is accepted without errors by Xtend, leading to a Java error.
Comment 1 Christian Dietrich CLA 2016-02-26 02:10:16 EST
is that a problem is collection extensions. should that be

public static <E> boolean operator_add(Collection<? super E> collection, Iterable<? extends E> newElements) {
    return addAll(collection, newElements);
}
Comment 2 Eclipse Genie CLA 2016-08-26 03:38:26 EDT
GitHub Pull Request 6 created by [cdietrich]
https://github.com/eclipse/xtext-lib/pull/6
Comment 3 Christian Dietrich CLA 2016-09-14 05:01:47 EDT
fixed in xtext 2.11
Comment 4 Christian Dietrich CLA 2016-09-14 13:16:49 EDT
reopened, reverted fix. has negative impacts on type inference