Xtend

Xtend is a statically-typed programming language which is tightly integrated with and runs on the Java Virtual Machine. It has its roots in the Java programming language but improves on a couple of concepts:

  • Advanced Type Inference - You rarely need to write down type signatures
  • Full support for Java Generics - Including all conformance and conversion rules
  • Closures - concise syntax for anonymous function literals
  • Operator overloading - make your libraries even more expressive
  • Powerful switch expressions - type based switching with implicit casts
  • No statements - Everything is an expression
  • Template expressions - with intelligent white space handling
  • Extension methods - Enhance closed types with new functionality optionally injected via JSR-330
  • property access syntax - shorthands for getter and setter access
  • multiple dispatch aka polymorphic method invocation
  • translates to Java not bytecode - understand what's going on and use your code for platforms such as Android or GWT

It is not aiming at replacing Java all together. Therefore its library is a thin layer over the Java Development Kit (JDK) and interacts with Java exactly the same as it interacts with Xtend code. Also Java can call Xtend functions in a completely transparent way. And of course, it provides a modern Eclipse-based IDE closely integrated with the Java Development Tools (JDT).

Top

Getting Started

The best way to get started is to materialize the Xtend Tutorial example project in your workspace. You'll find it in the new project wizard dialog.

The project contains a couple of sample Xtend files, which show the different language concepts in action. You should also have a look into the xtend-gen folder which contains the generated Java-version of them.

Xtend and Java Vis-a-Vis