Community
Participate
Working Groups
Build Identifier: Xtext 2.1.1.v201111141332 xtend: def dispatch getOperations(Facade f) { if (f == null || f.features.nullOrEmpty) return newArrayList return f.features.filter(typeof(Operation)) } def dispatch getOperations(Mapper m) { if (m == null || m.features.nullOrEmpty) return newArrayList return m.features.filter(typeof(Operation)) } generated java: public Iterable<? extends Object> getOperations(final StructuralFeature f) { if (f instanceof Facade) { return _getOperations((Facade)f); } else if (f instanceof Mapper) { return _getOperations((Mapper)f); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(f).toString()); } } protected Iterable<? extends Object> _getOperations(final Facade f) { boolean _operator_or = false; boolean _operator_equals = ObjectExtensions.operator_equals(f, null); .... => BUG: protected Object _getOperations(final Mapper m) { boolean _operator_or = false; boolean _operator_equals = ObjectExtensions.operator_equals(m, null); if (_operator_equals) { _operator_or = true; ~serano Reproducible: Always Steps to Reproduce: 1. see details (=> BUG) 2. 3.
workaround is to explicitely define a return type (Iterable<Operation>) def dispatch Iterable<Operation> getOperations(Facade f) { if (f == null || f.features.nullOrEmpty) return newArrayList return f.features.filter(typeof(Operation)) } def dispatch Iterable<Operation> getOperations(Mapper m) { if (m == null || m.features.nullOrEmpty) return newArrayList return m.features.filter(typeof(Operation)) } regards serano
newArrayList is not parameterized with any type argument. So it defaults to ?. You could either provide more type information in the return type or have an explicit type argument: return <Operation>newArrayList We might want to add a warning if that little type information is available. As soon as we have means to suppress or deactivate them again :-)
Fixed with new type system.
Requested via bug 522520. -M.