Java interoperablility

Java Interoperability

Xtend, like Java, is a statically typed language. In fact Xtend  completely supports Java’s type system, which includes primitive  types like int boolean and  arrays and all the Java classes, interfaces, enums and annotations that resides on the class path.

Java generics are  supported too:

Yes,You can define type the parameters on methods or the  classes and you can pass type arguments to most  generic types just like what you have done around in java. The type system and its accordance   are implemented as defined in the Java Language Specification.

Type Inference

One of the problems with Java is that you are forced to write type signatures over and over again. That is why so many people do not like static typing. But this is in fact not a problem of static typing but simply a problem with Java. Although Xtend is statically typed just like Java, you rarely have to write types down because they can be computed from the context.

Interoperability with Java language

Supporting every aspect of Java’s type system ensures that there is no mismatch or miscommunication commands between Java and Xtend. This defintely means that Xtend and Java are 100 percent  interoperable. There are definitely no exceptional cases and you do not have to think in two worlds. You can invoke the Xtend code from Java and vice versa  hassle-free.

As a bonus if you are familiar with  Java’s type system and are familiar with Java’s generic types, you already know the most complicated part of Xtend which is advantage you.

Reference  and credits:

http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.xtend.doc%2Fcontents%2F15-types.html