| Summary: | Syntax error in closure | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Hauke Fuhrmann <haf> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sven.efftinge |
| Version: | unspecified | Flags: | sven.efftinge:
indigo+
|
| Target Milestone: | SR1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
this has already been fixed. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: 20110615-0604 This example xtend file generates code where the part "public Boolean apply(final ? e)" cannot be comiled: ------------------ import java.util.ArrayList class Test { def <T> ArrayList<T> test(Iterable<T> iterable){ var list = new ArrayList<T>() for(item:iterable){ if(!list.exists(e|e==item)){ list.add(item) } } list } } ------------------ generates to ------------------ import java.util.ArrayList; import org.eclipse.xtext.xbase.lib.BooleanExtensions; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ObjectExtensions; @SuppressWarnings("all") public class Test { public <T> ArrayList<T> test(final Iterable<T> iterable) { ArrayList<T> _xblockexpression = null; { ArrayList<T> _arrayList = new ArrayList<T>(); ArrayList<T> list = _arrayList; for (T item : iterable) { final Function1<?,Boolean> _function = new Function1<?,Boolean>() { public Boolean apply(final ? e) { boolean _operator_equals = ObjectExtensions.operator_equals(e, item); return ((Boolean)_operator_equals); } }; boolean _exists = IterableExtensions.<?>exists(list, _function); boolean _operator_not = BooleanExtensions.operator_not(_exists); if (_operator_not) { list.add(item); } } _xblockexpression = (list); } return _xblockexpression; } } Reproducible: Always