Community
Participate
Working Groups
For the following Xtend2 file: public class Foo<T> { def foo() { [T x|x].apply(null) } } an error marker is generated for the closure body expression "x": "Incompatible implicit return type. Expected T but was Result". I don't think there should be an error marker in this case. Workarounds. Change the code to read: public class Foo<T> { def foo() { [T x|x as T].apply(null) } } or: public class Foo<T> { def T foo() { [T x|x].apply(null) } }
I was further surprised to find that the example works if the generic type is declared on the method instead: public class Foo { def <T> foo() { [T x|x].apply(null) } }
This bug has been fixed in Xtend 2.4.