| Summary: | [xtend] Generic Type and method parameters | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Benjamin Schwertfeger <benjamin.schwertfeger> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | christian.dietrich.opensource, mail, sebastian.zarnekow |
| Version: | 2.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
The tests for this issue revealed some other problems in the type computation. However, the issue itself was 'mostly' fixed.
The following problem remains:
def <T, U extends T> Collection<T> addAll2(Collection<T> collection,
Iterable<U> elements){
collection.<T>addAll(elements) <<- for now, this expression requires an explicit type arg
}
Pushed to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
The method def <T> Collection<T> addAll2(Collection<T> collection, Iterable<? extends T> elements){ collection.addAll(elements) //ERROR HERE collection } shows an error, that elements should be an Iterable<? extends T>. If it's written with another generic type instead of ? extends T at the signature the editor shows no bug, but... def <T, U extends T> Collection<T> addAll2(Collection<T> collection, Iterable<U> elements){ collection.addAll(elements) collection } The generated code contains CollectionExtensions.<?>addAll(collection, elements); which is a bug at the method call with type <?>. If you change xtend to collection.<T>addAll(elements) this works again.