Table of Contents

Xtext 2.13.0 Release Notes  Oct 20, 2017

Xtend 2.13 is out

Xtend 2.13 is mainly a bugfix release.

Fixed Issues

As in every release we are eagerly hunting down the bugs, review and integrate lots of contributions. 88 issues, 62 Pull Requests and 60 Bugzilla tickets have made it into this release. For further details please refer to the following lists:

Xtend 2.11.0 Release Notes  Feb 1, 2017

Xtend version 2.11 comes with a new source repository and plenty of improvements and bug fixes.

New Source Repository

The Xtend code base has been moved to a dedicated repository xtext-xtend in the course of the restructuring of Xtext (see the Xtext 2.11.0 Release Notes).

The Xtend Language and Library

String Concatenation Performance Improvements

The performance of string concatenation, e.g. as used for rich strings, has been improved. This change has important consequences for working with Xtend: you should make sure that you use consistent versions of Xtend in your host IDE and your target platform in order to avoid compatibility problems.

Improved Compiler

The Java code produced by the Xtend compiler is now less verbose and more readable. For many situations Xtend does not produce synthetic variables anymore.

For switch statements on Strings an additional null guard is produced. This lead to NPEs when a null argument was passed to the switch statement.

A for-loop over an array resulted in uncompilable Java code. This has been fixed.

Comparison with null

For comparison expressions with null as argument it is more efficient to use the triple (not) equals operator === and !== instead of == and !=. While the “normal” operators will result in a call of Objects.equal, the triple equals operator can perform a direct comparison.

For these situations a warning is produced and a quickfix is offered.

New Class Wizard

The New Xtend Class wizard has an option to create a main method.

Xtend 2.9.0 Release Notes  Dec 1, 2015

Version 2.9 adds support for IntelliJ and includes many bug fixes. (full bugzilla list).

IntelliJ IDEA support

There is now an Xtend plug-in for IntelliJ IDEA. The plug-in provides a smart code editor for Xtend files, including syntax highlighting, code completion, on-the-fly validation, automatic compilation in the background, and more. The plug-in uses the same parser and compiler as Eclipse, but we had to re-implement large parts of the UI integration code.

Create a new Xtend type (class, interface, or enum) inside Java packages.

Enjoy the smart code editor with syntax highlighting and code completion. The latter also proposes Xtend’s extension methods. The example from this screenshot is a small JUnit test, which - obviously - can also be launched as such.

Android Studio Support

Xtend now supports Android Studio, which uses IntelliJ IDEA as a foundation. This is not to be confused with the Android Developer Tools, which are based on Eclipse and which have been supported by Xtend since the very beginning.

This is exciting news as it allows you to use lambda expressions and Active Annotations for Android development - something neither Android Studio nor ADT support out of the box.

Xtend 2.8.0 Release Notes  Mar 11, 2015

Version 2.8 got many new features, bug fixes, and performance improvements (full bugzilla list).

The most noteworthy changes are the following.

Target Java Version

The new version of the Xbase compiler allows to configure the Java version of the generated code. The default is to use the same version as set for the source compatibility of the Java compiler (Java → Compiler → Source compatibility), which is in turn usually set to the same version as the compiler compliance level. The Xbase compiler settings can be configured in the Compiler preference page or project properties page of your Xbase language.

By unchecking Use source compatibility level from Java settings, you can choose to generate Java code with a different version than is set for the Java compiler. The actual changes in the generated code are described in the following.

Java 5

Java 5 has been the version level of the Xtend compiler from the beginning, so the generated code is the same as with earlier Xtend versions if you choose this target version.

Java 6

When the Xtend compiler is set to at least Java 6, it generates an @Override annotation to each method that overrides a method from a superclass or implements an interface method.

Java 7

Xtend expressions like switch (obj) { ... } where obj is of type String are translated to Java switch statements (see Strings in switch Statements).

In Xtend you can write number literals in the form 2_147_483_647 to enhance their readability. This is also supported by Java 7. When the Xtend compiler is set to at least Java 7, underscores in number literals are retained in the generated code.

Java 8

Xtend lambda expressions like [String s | s.toLowerCase] are translated to Java 8 lambda expressions, e.g. (String s) -> return s.toLowerCase();. More details on this translation are discussed in this blog post.

Note that independent of which Java version is chosen for the generated code, Xtend works perfectly with the lambda-optimized Java 8 API because Xtend lambdas are fully compatible with Java 8 lambdas.

Xtend allows to define non-abstract methods (static or non-static) in interfaces when Java 8 is chosen as target language level. If such a method is non-static, it is translated to a Java 8 default method.

More Compiler Options

You can now disable the automatic generation of @SuppressWarnings annotations for generated classes. Furthermore, you can enable the generation of @Generated annotations for all generated types, which can be useful for automatic processing of the source code, e.g. when you want to exclude generated types in code analysis tools. The annotation also allows to attach more information, which can be enabled in the preferences.

Enhancements of the Xtend Editor

Open Generated File

You can open the Java file that was generated from Xtend by right-clicking the Xtend editor and selecting Open Generated File.

Open Inferred Type

You can open the declaration of the inferred type of a local variable by Ctrl-clicking (Cmd on Mac) the variable name.

Improved Hover for Annotations

Hovers of annotated members have been improved and allow to navigate to annotation values.

Unique Class Name Validation

If your Xtend type’s qualified name collides with another Java or Xtend type in the same project you now get an error.

Convert Java to Xtend

The new version features a Java-to-Xtend converter. Right-click a Java file, package or source folder in the Package Explorer and select Convert to Xtend. You can choose to keep the original Java files (though that will lead to errors due to duplicate types), and you are warned if the Java code contains parts that cannot be translated automatically. These are marked with FIXME comments in the Xtend code. However, the converter is able to convert the majority of Java classes without problems.

Active Annotations

Constant Field Initializer

MutableFieldDeclaration now features a set of methods like setConstantValueAsInt(int value) for creating static final fields with constant initializers. All primitive values as well as String are supported.

Default Methods

If the Xtend compiler is set to Java 8, you can create a method with default implementation in a Java interface by defining a method body and setting the abstract flag on the MutableMethodDeclaration.

Faster Builds and More Responsive UI

Compiling an Xtend resource involves a lot of computation. With 2.8 we store the computed resource state and reload it if no changes have happened. This leads to a significantly faster build.

Into the bargain, user actions like saving an editor now cancel the auto-build and are no longer blocked by it.

Xtend 2.7.0 Release Notes  Sep 2, 2014

Version 2.7 got many new features, bug fixes and performance improvements (full bugzilla list). The most noteworthy changes are the following.


Sugared Lambdas With Zero And More Than Two Arguments

It is now allowed to leave out parameter declarations for all lambda expressions using a positional syntax, similar to Apple's Swift:

#[1, 2, 3].reduce[$0 + $1]

Unqualified Enum Usage

Enum constants in annotations and switch expressions can be referenced without their type name.

Inner Type of Parameterized Types

Type inference for parameterized inner classes was improved and supports types like

Deprecated and Dead Code Analysis

The validator will now detect use of deprecated API and is much better at finding dead code. Would you have spotted the following?


New Extension Methods on Iterables

The standard library has new extension methods for Iterables, including min/max, groupBy and indexed.

#["Xtend", "Java", "Eclipse"].maxBy[length]

New Active Annotations

New Active Annotations have been added to free you of some repetitive tasks. The new @Accessors generates getters and setters, with fine grained control and even for all fields of a class if you want. The @Delegate annotation automatically implements the delegation pattern for you, so you only need to concentrate on methods that you actually want to implement differently than just delegating. Here is an example:

interface I {
def void m1()
def void m2()
def void m3()
class A implements I {
override m1() {}
override m2() {}
override m3() {}
class B implements I {
//all methods automatically implemented
@Delegate A delegate = new A

Other additions include @ToString, @EqualsHashCode, @FinalFieldsConstructor and a new @Data (the old one is now deprecated as well as @Property).

Active Annotations API Improvements

The active annotation API integrates even deeper with the IDE. Every generated element can (and should) now declare its source element. This tracing information is used in places like the outline view. A separate validation phase has been added, so the end result after running all transformations can be validated. Also, changes to classes and even arbitrary resources that the annotation processor requested are detected and lead to automatic rebuilds.

IDE Features


Xtend breakpoints can now have conditions. Conditions are written in Java, so you get full access even to synthetic variables inserted by the Xtend compiler. Of course you also get content assist in the condition editor.

Breakpoints can now be toggled, enabled/disabled and inspected via the ruler context menu.

Content Assist

Content Assist has become a lot faster and more accurate at the same time. It will now also retain the "is"-prefix of boolean properties.

Performance Improvements

Performance has reached a new level with big improvements to Content Assist, parallel code generation and lots of fine tuning. Also, Xtend will now cancel jobs (like outline refreshing) when you start typing again, making the editor much more responsive.

Outline with Java-Mode

The outline view now supports two modes: One shows the original Xtend AST, the other one shows the resulting Java AST. This is very useful in the presence of Active Annotations that add a lot of new members to a class.

Organize imports on packages

You can now use "Organize Xtend Imports" on whole packages via the "Source" context menu.

Template proposals support import

A new type of template variable was added. It adds an import to an Xtend file when the template is inserted. This greatly reduces the need for qualified type names in templates.

Open return type

Ever wondered what you can do with the type of a variable or the return type of a method? You can now CTRL-Click on feature calls and open the declaration of the return type of that call.

Show errors from derived Java files

By using black box Java code within active annotations the generated Java source could sometimes have errors while the Xtend code is fine. In those cases, the errors are now shown at the appropriate locations in Xtend as well.

Maven and Java 8

The Xtend Maven plugin is now toolchain-aware. Using this, you can for instance run Maven on Java 8, but compile against a JDK 6.

Xtend 2.6.0 Release Notes  May 21, 2014

Version 2.6 got many bug fixes and performance improvements (full bugzilla list). The new features are the following.

Anonymous Classes

Xtend supports using lambdas to implement anonymous classes with just one abstract method since its inception. For interfaces and abstract classes with more than one method you can now also use the an anonymous class using the following syntax:

val tabListener = new ActionBar.TabListener() {

    override onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
        // show the given tab

    override onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
        // hide the given tab

    override onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
        // probably ignore this event

Static Nested Classes

Xtend now supports static nested classes.

class A {
    static class NestedClass {

Operator Declarations

In addition to overloading operators by adhering to the name mappings, listed in the documentation, one can now use the actual operator in the declaration as well.

class Money {
    def + (Money other) { ... }
    def - (Money other) { ... }
    def * (BigDecimal times) { ... }

Synchronized Expression

The synchronized expression works basically like Java's synchronized statement.

synchronized(lock) {
    // do stuff

But of course it is an expression, as everything in Xtend/Xbase. So you can write the following as well:

someMethodCall(synchronized(lock) { ... })

Qualified Static Imports

It is now possible to import features in a fully qualified way. This works for regular static imports as well as for extension imports.

// static import
import static java.util.Collections.singleton
// extension import
import static extension java.util.Collections.min
import static extension java.util.Collections.max

Switch Fall Through

The switch expression now supports a kind of fall through. Here's an example

	switch myOperator {
		case '+',
		case '-' : handlePlusMinus()    
		case '*',
		case '/' : handleDivMultiply()
		default : throw new IllegalStateException

Compound Assignments

Xtend now supports compound assignment operators.

var i = 0
i += 42

Compound operators work on overloaded operators as well. That is you don't need to declare '+=' if you have '+' defined. Example:

var distance =
distance +=

Postfix Operators

Postfix operators for incrementing and decrementing numbers have been added.

var i = 0
while (condition()) {

Traditional For-Loop

The traditional for-loop from Java is now available in Xtend, too.

for (var i = 0; i < 99; i++) {
    println(''+i+' bottles of beer on the wall.')

Multivalued Annotations Sugar

Instead of writing

@SurpressWarnings(#["unused", "unchecked"])

you can write

@SurpressWarnings("unused", "unchecked")

Active Annotations - Flag fields as read resp. initialized

When initializing a final field within a synthetic constructor, the control flow analysis couldn't detect it was in fact initialized and would raise an error. Another typical solution was a warning when a private field was only accessed through methods added by an active annotation (e.g. a setter or getter). You can now mark a field as read resp. initialized.

Style Checks

2.6 adds the following optional compiler checks (inactive by default):

Force return expression

Force declare return types

Force empty parenthesis on method invocation

Task Tags

TODO, FIXME, and XXX markers in comments are now recognized by the IDE as task markers. The Xtend editor picks up the preference of JDT for adding new kind of markers or removing existing ones.

Open Implementation

In addition to the "Go to declaration"-action, you can now navigate to existing implementations of a method. It works just like in JDT

Debug Hover Shows Inspect Dialog

In a debug session, when hovering over a local variable or a visible field, the popo up shows the inspection tree of the hovered value.

Hover Shows Annotations

The declaration hover now includes the annotations.

Gradle Plug-in

A gradle plug-in for easy integration of the Xtend compiler in any gradle based Java projects is now available. The gradle plug-in even also works with the new Android buildsystem developed by Google.
The gradle plug-in is hosted at github.

buildscript {
  repositories {
  dependencies {
    classpath 'org.xtend:xtend-gradle-plugin:0.0.8'
apply plugin: 'xtend'
repositories {
dependencies {
  //or testCompile if you only want to use Xtend for some tests
  compile 'org.eclipse.xtend:org.eclipse.xtend.lib:2.6.0'

Treeshaken Lib for Android

For large Android projects there is a need to have as little code packaged as possible. Usually this is achieved by proguarding cour code and the dependencies during the build. For people who find that tedious and want to work with a reduced lib from the get go, we offer a treeshaken version of the library, which is only 300k small.

The library can be downloaded from maven central.

Xtend 2.5.0 Release Notes  Dec 11, 2013

With over 100 bugfixes, Version 2.5.0 is mainly a bugfix and performance release. The team has been working on ironing out any glitches in the user experience and further improving a fluent workflow with the language and the tools.

Full support for Java 7 Annotations

The Xtend compiler now supports all annotation values and constant expressions in annotations. These annotation can be evaluated during compilation within active annotations. Also all values supported in Java can now be set during annotation processing.

annotation Columns {
  Column[] value = #[ @Column('id') ]
annotation Column {
  String value
  int length = 2 << 16
class Entity {
  @Columns(#[@Column('id'), @Column(value = 'timestamp', length = 2 * 3 * 7)])
  CompositeKey key

Improved compiler checks

The Xtend compiler now detects ambiguously overloaded methods.

Method overload validation

Ambiguous method invocations are checked and reported with a detailled message. The compiler optionally detects valid but suspiciously overloaded methods that could be implemented by accident. This is especially handy when property access and extension methods come into play.

class A {
  def isCheck() {..}
class B extends A {
  def m() {
	 * Ambiguous feature call.
	 * The methods
	 *     getCheck() in B and
	 *     isCheck() in A
	 * both match.
  def getCheck() {..}
Important note:

You have to make sure to use the library in version 2.5 along with the introduced compiler checks.

Discouraged variable names

Some variable names are used implicitely by Xtend, for example the variable name 'self'. The compiler optionally reports if these names were picked manually.

Small language enhancements

Some refinements have been made to the Xtend language semantics to improve the overall experience.

Auto casts

Xtend supported auto-casts right from the beginning with its powerful switch expression. In 2.5, the more familiar syntax with instance-of checks caught up and also applies automatic casts in if expressions and while loops.

def m(CharSequence c) {
  if (c instanceof String) {

Switch over enums

One of the few places where Xtend's syntax could be improved compared to Java, was a switch expression over enumeration values. Now it's no longer necessary to use a qualified name or static imports for the enum values but the literals are available automatically for the case guards.

def m(RetentionPolicy p) {
  switch p {
	case CLASS: 1
	case RUNTIME: 2
	case SOURCE: 3

Customizable template expression

The template expressions can now be semantically enhanced via target typing. One use case is code generation where imports are automatically added when concatenating a type or if the appended object does not have a proper string representation. It is also possible to pass an explicit line delimiter rather than using the platform default.

def StringConcatenationClient m() '''my template''' // uses target type

// caller code
val result = new StringConcatenation(lineDelimiter) // custom line delimiter or subtype
return result.toString()

Improved type inference with primitive values

The local type inference has been improved when primitive types are involved. Their wrapper types will be used in fewer cases which prevents unexpected exceptions at runtime. An optional compiler check can point to places where primitive defaults are used rather than explicit values.

Better experience with Maven and Android

The Android archetype for Maven was improved. It properly configures the compiler and debug settings, uses the latest Android libraries and the produced Eclipse project matches the structure that is created by the ADT wizards.

Xtend 2.4.3 Release Notes  Sep 4, 2013

The team is proud to present a release with more than 450 bug fixes and features.

Android Support

Xtend is a great choice for Android application development because it compiles to Java source code and doesn't require a fat runtime library. With version 2.4 the Android support has been further improved.


Debugging Android applications works now. Previously Xtend supported debugging through JSR-45 only, which is not supported by the Dalvik VM. Now you can configure the compiler to install the debug information in a Dalvik-compatible manner.

Maven Archetype

There is also a Maven archetype to set up a working Android project easily. If you have installed Maven and the Android SDK you only need the following command to get started:

mvn archetype:generate -DarchetypeGroupId=org.eclipse.xtend \
-DarchetypeArtifactId=xtend-android-archetype \

New Language Features

The following new features have been added to the Xtend language.

Streamlined Java syntax

In 2.4.2 we have introduced new (more Java-like) ways to access nested classes and static members. Also type literals can be written by just using the class name.

Here is an example for a static access of the generated methods in Android's ubiquitous R class: 
// previously it was (still supported) :

Type literals can now be written even shorter. Let's say you want to filter a list by type:

// where previously you had to write (still supported) :

If you use the Java syntax (e.g. MyType.class), you'll get an error marker pointing you to the right syntax.

Active Annotations (Provisional API)

Active Annotations let developers particpate in the translation process from Xtend code to Java source code. The developer declares an annotation and a call back for the compiler where the generated Java code can be customized arbitrarily. This doesn't break static typing or the IDE! Any changes made in an active annotation are completely reflected by the environment. A simple example would be a JavaBeans property supporting the Observer pattern. Here you need a getter and a setter method for each field and also an observer list and the proper code to notify them about changes. In many software systems you have hundreds of these properties. Active Annotation allow you to define and automate the implementation of such patterns and idioms at a single point and let the compiler expand it on the fly. And all this based on lightweight, custom libraries. You do no longer have to write nor read the boiler plate code anymore. Read more...

Collection Literals and Arrays

Xtend now has literals for unmodifiable collections.

val listOfWords = #["Hello", "Xtend"]
val setOfWords  = #{"Hello", "Xtend"}
val mapOfWords  = #{1->"Hello", 2->"Xtend"}

Collections created with a literal are immutable. The list literal can be used to natively create arrays, too. If the target type is an array, it will compile to an array initializer.

val String[] arrayOfWords = #["Hello", "Xtend"]

In addition to literals for arrays you can now also easily access and modify arrays as well as create empty arrays of any size.

val String[] arrayOfWords = newArrayOfSize(2)
arrayOfWords.set(0, 'Hello')
arrayOfWords.set(1, 'Xtend')

Interfaces, Enums and Annotations

Interfaces, enumerations and annotation types can now be declared directly in Xtend.

interface Container {
def T findChild((T)=>boolean matcher)

enum Color {

annotation DependsOn {
Class<? extends Target> value
val version = "2.4.0" // type 'String' inferred 

Extension Provider

Extension methods allow to add new methods to existing types without modifying them. Consider the omnipresent class java.lang.String. If you have to parse a string to a number, you could always write


but what you actually think of is


To make that possible, you simply import the class Integer as a static extension:

import static extension java.lang.Integer.*

This enables to pass the base of the number as an argument, too:

Extension methods are available in other language such as C# as well, but Xtend can do better. The new Extensions Providers render a former limitiation obsolete: In Xtend 2.4, fields, parameters and local variables can provide extensions, too. Read more...

SAM Type Conversion

Lambda expressions now work with interfaces and classes with a single abstract method (SAM types). For example, the AbstractIterator from the Guava library has a single abstract method computeNext(). A lambda can be used to implement that:

val AbstractIterator<Double> infiniteRandomNumbers = [| Math::random]

New Operators

Some new operators have been added. In addition to the usual == and != operators which map to Object.equals(Object), the operators === and !== respectively can be used to test for identity equality.

if (myObject === otherObject) {
println("same objects")

Also new exclusive range operators have been introduced. In order to iterate over a list and work with the index you can write:

for (idx : 0 ..< list.size) {
println("("+idx+") "+list.get(idx))

Or if you want to iterate backwards :

for (idx : list.size >.. 0) {
println("("+idx+") "+list.get(idx))

New IDE Features

Being an Eclipse project Xtend has always been designed with IDE integration in mind. The team is proud to announce that the editing support is now almost on par with Java's and in some aspects already even better. A user recently wrote in the newsgroup:

Tooling for Xtend is unlike any other language for the JVM after Java. The IDE support is first class. It will take years for some languages to catch up. Some never will.

The following new IDE features improve the editing experience significantly:

Organize Imports

With the new release we have overhauled the Organize imports action. It processes all kinds of imports, asks to resolve conflicts, and shortens qualified names automatically.

Extract Method and Extract Local Variable

New refactorings have been added. You can now extract code into a new local variable

or into a new method.

Supression of Follow-Up Errors

Follow-up error markers are now suppressed and errors in general are much more local, so it is very easy to spot the problem immediately.

Optional Errors and Warnings

The severity of optional compiler errors can be configured globally as well as individually for a single project. They can either be set explicitly or delegate to the equivalent setting of the Java compiler.

More Quickfixes

Xtend now offers to create missing fields, methods, and types through quick fix proposals.

Improved Content Assist

The content assist has become much smarter. It now proposes lambda brackets if the method accepts a single function and it offers hints on the parameter types when you are working with overloaded methods.


A configurable formatter which pretty prints and indents code idiomatically is now available.


An Xtend editor now has validation and content assist within JavaDoc comments.

Copy Qualified Name

You can use Copy Qualified Name in the editor and the outline view to copy the name of types, fields and methods into the clipboard.