Table of Contents


Xtend 2.18.0 Release Notes  Jun 4, 2019


Xtend 2.18.0 provides new language features (Ternary Expressions and Try-With-Resources) and some smaller improvements.

Ternary Expressions

Xtend now allows to use the ternary operator. This enables to assign conditional values to variables in the shortest possible way, as already well known from Java.

val v = condition ? “thenValue” : “elseValue”

If it is disapproved to use ternary expressions, it is possible to flag them with an error and convert them via quickfix into a traditional if-expression.

val v = if(condition) “thenValue” else “elseValue”

Try With Resources

Try statements are often used with resources, that have to be closed in the finally block. Xtend now supports the convenient try-with-resources expression. This closes the opened resources automatically at the end of the try block - without having to code that explicitly.

def m() {
    val resource = new StringReader("This \n is a text!");
    try
        return resource.read
    finally
        resource?.close     
}

Becomes:

def m() {
    try (val resource = new StringReader("This \n is a text!"))
        return resource.read
}

Eclipse Integration

New Quickfix: Rename Class

When an Xtend class name does not match the file name it is defined in then Xtend raises a warning. A new quickfix has been provided to rename the class according to the file name. (#744)

Quickfix: Rename Class

Quickfix “Remove Unused Member” Improved

The quickfix “Remove member” for unused members was improved. Additionally to the member itself the quickfix will now also remove obsolete import statements and write accesses. (xtext-xtend)

Xtend Elements Wizards in Project Explorer / Navigator View

Context menu entries to trigger New Wizards for Xtend elements were only offered in the Package Explorer. These entries are now additionally offered in the context menu in the Project Explorer and Navigator views. (xtext-xtend#699)

Maven Integration

When the goal xtend-install-debug-info is executed on empty source directories, a warning is raised by default:

[WARNING] Directory <SOURCE_DIR> is empty. Can't process.

This warning can now be suppressed by configure the new parameter showEmptyDirWarning to false. (xtext#787)

Xtend Compiler

The Xtend batch compiler lookup order preferred classes in jars on the classpath before local classes that are on the source path. The order has been changed so that local classes are now first on the search path. (#750)

Credits

The Xtend Language project is thankful for the dedication of each committer and contributor. This release has been made possible by the following persons (in order of the number of contributed commits to this release):

  • Christian Dietrich (itemis)
  • Karsten Thoms (itemis)
  • Sebastian Zarnekow (itemis)
  • Arne Deutsch (itemis)
  • Holger Schill (itemis)
  • Eva Poell (itemis)
  • Lorenzo Addazi
  • Niko Stotz (Altran)
  • Max Leuthäuser (itemis)
  • Vivien Jovet

Fixed Issues

As in every release cycle we were eagerly hunting down bugs, and reviewed and integrated plenty of contributions. More than 20 issues and almost 60 pull requests have made it into this release. For further details please refer to the following lists:


Xtend 2.17.1 Release Notes  Apr 3, 2019


This is a hotfix release. Here is the list of fixed issues:

  • There was a bug in the Xtext Builder that leads to non Xtext projects being built by Xtext.
  • The LSP4J version in Xtext 2.17.0 did not match the one in Eclipse 2019-03. Upgraded to LSP4J 0.7.0.
  • The Xtend Batch Compiler preferred classes found on the classpath over local classes.

Xtend 2.17.0 Release Notes  Mar 5, 2019


This release focuses on the compatibility with Java 11 & Eclipse 2019-03, stability, performance and technical debt reduction.

Java 11

Xtend is now fully compliant with Java 11. Java 11 can be chosen as runtime VM and as target version for the compiler.

xtend-maven-plugin

BOM Managed Dependencies

One major pain point with past releases was that the xtend-maven-plugin used ranged dependencies. This lead sometimes to problems with the plugin execution, which had to be worked around by clients by explicit dependency management.

Solving this problem was one of the main motivations behind the introduction of the new Maven BOM. With this BOM all external dependencies of Xtext and its Maven plugins are managed in compatible versions without room for interpretation of dependency version ranges.

Upgrade to Maven 3 API

The xtext-maven-plugin has been refactored to use the latest Maven 3 API. The most significant internal change is that all doclet based configurations have been changed to use Maven 3 annotation API.

Faster Startup

The plugin was using version ranges for some of its dependencies, especially Google Guava. Resolving the metadata of these ranged dependencies lead to a short time delay on execution of the plugin. All used dependency versions have been pinned to a single version, which speeds up the plugin execution.

Resolve Usage of Deprecated API

The plugin has been refactored to resolve all usages of deprecated API from Eclipse Platform and m2e bundles. (to issue)

Quickfixes

Quickfix for ‘unused private member’

The unused private member issue can now be resolved by a quickfix. The quickfix is capable to resolve multiple selected issues at once when selected from the Problems view. (details)

Quickfix for 'unused private member'

Quickfix to Add the Abstract Modifier

If a class is named something like ‘AbstractFoo’ but is not declared abstract. A warning is raised and can be resolved via quickfix insertion of the abstract modifier. (details)

Quickfix to add the abstract modifier

Static Member Favorites

Annoyed by typing org.junit.Assert.assertEquals to use static methods? Wouldn’t it be cool having all your favorite static methods at hand and let the language do the import automatically? In JDT this feature is known as Static Member Favorites and it comes with a preference page, where you can configure which class’s methods should be visible. Besides wildcard imports you could make a single method visible - it’s up to you.

Use favorites for static import

We thought it’s a good idea to reuse the already defined JDT preferences in Xtend. Since this release Xtend supports Static Member Favorites like Java does - but a bit more.

Invoke content assist static import

In Xtend we have extension methods. Here the first parameter becomes the implicit receiver. The visible static methods are analysed to fit as an extension method and then gets imported like that.

Invoke content assist static import

Deprecations

Deprecation of Android Archetype

The Maven archetype org.eclipse.xtend.maven.android.archetype has been deprecated with this version and is no longer published.

The bundles org.eclipse.xtend.lib.gwt and org.eclipse.xtext.xbase.lib.gwt are now deprecated. They are subject for removal in one of the next releases.

Credits

The Xtend Language project is thankful for the dedication of each committer and contributor. This release has been made possible by the following persons (in order of the number of contributed commits to this release):

  • Christian Dietrich (itemis)
  • Karsten Thoms (itemis)
  • Holger Schill (itemis)
  • Tamas Miklossy (itemis)
  • Sebastian Zarnekow (itemis)
  • Arne Deutsch (itemis)
  • Prajwal Gowda (itemis)
  • Eva Poell (itemis)
  • Stéphane Galland

Fixed Issues

As in every release cycle we were eagerly hunting down bugs, and reviewed and integrated plenty of contributions. More than 18 issues and almost 50 pull requests have made it into this release. For further details please refer to the following lists:


Xtend 2.16.0 Release Notes  Dec 4, 2018


This release focuses on stability, performance and the compatibility with Eclipse 2018-12.

Inside Xtend source files, hovering over a link inside a Javadoc will now display the Javadoc comments in a hover pop-up. F3 is also supported on these links.

Hover Example

Triple-equals quickfix is now a multifix

Warnings of the type The operator '!=' should be replaced by '!==' when null is one of the arguments. could only be fixed one by one. The quickfix has been extended to allow fixing multiple issues at once.

Deprecation of GWT

We will no longer maintain the GWT versions of Xbase and Xtend Lib. The corresponding jars will be no longer published with future versions of Xtext (likely from 2.17 on).

Outlook for 2.17

Java 11 Support, a Maven BOM and a new MWE version are planned for 2.17.

Fixed Issues

As in every release cycle we were eagerly hunting down bugs, and reviewed and integrated plenty of contributions. More than 90 issues and almost 300 pull requests have made it into this release. For further details please refer to the following lists:


Xtend 2.15.0 Release Notes  Sep 4, 2018


This release focuses on stability, performance and the integration in Eclipse 2018-09.

Minimal Required Target Platform

Xtext and Xtend 2.15 are built and tested against Eclipse Oxygen.3a and newer. Thus we recommend to use at least Eclipse Oxygen.3a or even better Eclipse 2018-09. For older versions of the Eclipse Platform we cannot guarantee backwards compatibility even though we carefully assess any changes that are made.

Smarter Organize Imports

In the past there were a couple of corner cases where organize imports did not yield the optimal result. It could even lead to broken code under certain conditions. We fixed these scenarios and organize imports now works nicely, even when multicatch or static extensions are involved.

Improved Performance of the Gradle Build

The Gradle build performance was greatly improved. Tasks that consumed lots of memory and even more CPU cycles could be fixed such that it’s now way faster to build Xtend with Gradle.

2.14:

2.15:

Fixed QuickFixes

In some cases, quick fixes broke existing code, this no longer happens.

Improved JUnit Support

Test methods must return void to be valid test cases. This is now statically checked by the Xtend validation.

New API IterableExtensions.reject(Class)

An overloaded variant of reject() was added for convience, this allows type based rejection of elements from an iterable.

Fixed Issues

As in every release cycle we were eagerly hunting down bugs, and reviewed and integrated plenty of contributions. More than a 100 issues and almost 300 pull requests have made it into this release. For further details please refer to the following lists:


Xtend 2.14.0 Release Notes  May 23, 2018


Java 9 and 10 Support

Xtext and Xtend 2.14 are able to compile with and against Java 10. Here are a few notes on the Support

  • There is no native support for Java 9/10 module visibilities but we fall back to jdt/javac on that topic.

Compiler

Avoid generation of unnecessary exception variables

When an exception variable is not used within a catch block, the transpiled Java code contained an unused variable.

Considering the following Xtend snippet:

try {
  ... some code ...
} catch (SomeException e) {
  // do nothing with "e"
}

The catch block was transpiled to:

catch (final Throwable _t) {
  if (_t instanceof SomeException) {
    final SomeException e = (SomeException)_t;
  } else {
    throw Exceptions.sneakyThrow(_t);
  }
}

Xtend will now avoid the generation of the variable when it is not used within the catch block:

catch (final Throwable _t) {
  if (_t instanceof SomeException) {
  } else {
    throw Exceptions.sneakyThrow(_t);
  }
}

Multi-Catch Support

With Xtend 2.14 the exception handling supports multi-catch clauses.

The multi-catch clause can handle an arbitrary number of exceptions separated by “|”.
Within the catch block, the intersection exception type of the exceptions caught by the multi-catch statement is available for further processing.
Multi-catch support leads to semantically rich and more concise catch statements.

Multi-Type Guard Support

The type guard feature in switch statements is enhanced by support for testing multiple types in one case statement.

As for the multi-catch statements the different types handled by a single case statement are separated by “|”.
The intersection type of the types specified in the multi-type guard statement is available within the case block.

Unnecessary Modifiers Validation

Xtend detects unnecessary modifiers in code, e.g. the public modifier on types. By default issues of this kind are raised as warnings, the severity level is configurable.

For convenient resolution of these issues a quick fix has been added.

Eclipse Integration

Organize Imports

The Organize Imports feature has been improved to consider inner types properly.

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 20 Bugzilla tickets have made it into this release. For further details please refer to the following lists:


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.