While working with fugue I encountered a bug with Xtend:
Xtend code:
class EitherTest {
com.atlassian.fugue.Either<Integer, Boolean> e1;
def void m() {
val Boolean b1 = e1.right().get();
}
}
This generates the following Java:
import com.atlassian.fugue.Either;
import com.atlassian.fugue.Either.RightProjection;
@SuppressWarnings("all")
public class EitherTest {
private Either<Integer,Boolean> e1;
public void m() {
RightProjection _right = this.e1.right();
final Boolean b1 = _right.get();
}
}
There are two problems here:
- The RightProjection type is being used raw (generic type information is lost). This makes the Either class useless.
- In this particular case a type mismatch error is being marked by Eclipse in the generated Java code on the last line. The Xtend code itself doesn't show any errors.