| Summary: | [xtend] Xtend compiler generates invalid java code | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Bernd Kolb <b.kolb> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR1 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
This is documented in the disabled testcase org.eclipse.xtext.xtend2.tests.linking.InferredJvmModelTest.testInferredFunctionWithTypeParameter() The code snippet seems to be invalid: T is nowhere defined. Bernd, did you declare T as a type parameter for the Xtend class? Added some test cases to document that the generated code is correct as long as T was defined somewhere. Since there are error markers if T was not defined, I close this ticket. Please reopen and provide a complete Xtend file if the problem is still present in the latest nightlies. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: 3.7.0 final Eclipse release, xtext distro from itemis The xtend2 compiler generates invalid java code for the following function: def toSeparatedString(Iterable<T> i, (T)=>String toStringFunc, String separator){ i.map(T x | toStringFunc.apply(x)).join(separator) } The result looks as follows: public String toSeparatedString(final Iterable<?> i, final Function1<?,String> toStringFun, final String separator) { final Function1<?,String> _function = new Function1<?,String>() { public String apply(final ? x) { String _apply = toStringFun.apply(x); return _apply; } }; Iterable<String> _map = IterableExtensions.<?, String>map(i, _function); String _join = IterableExtensions.join(_map, separator); return _join; } The inner apply Method uses ? as a type Reproducible: Always