blob: 04304ebfb0d073003e8434cbedb93ca0d4a76442 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Xtend - Release Notes</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Xtend is a statically typed programming language sitting on top of Java.">
<meta name="author" content="Sven Efftinge">
<meta name="author" content="Miro Spoenemann">
<!-- styles -->
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="/xtend/images/favicon.png">
<link href="/xtend/css/bootstrap.css" rel="stylesheet" type='text/css'>
<link href="/xtend/css/bootstrap-responsive.css" rel="stylesheet" type='text/css'>
<link href="/xtend/css/shield-responsive.css" rel="stylesheet" type='text/css'>
<link href='/xtend/css/fonts.css' rel='stylesheet' type='text/css'>
<link href="/xtend/css/prettyPhoto.css" rel="stylesheet" media="screen" type='text/css'>
<link href="/xtend/css/prettify.css" type="text/css" rel="stylesheet"/>
<link href="/xtend/css/style.css" rel="stylesheet" type='text/css'>
<!--[if lt IE 9]>
<link href="css/iebugs.css" rel="stylesheet" type='text/css'>
<![endif]-->
<!-- BEGIN Cookie Consent
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#000"
},
"button": {
"background": "#f1d600"
}
},
"theme": "edgeless",
"type": "opt-in",
onInitialise: function (status) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// TODO: enable cookies
}
if (type == 'opt-out' && !didConsent) {
// TODO: disable cookies
}
},
onStatusChange: function(status, chosenBefore) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// TODO: enable cookies
}
if (type == 'opt-out' && !didConsent) {
// TODO: disable cookies
}
},
onRevokeChoice: function() {
var type = this.options.type;
if (type == 'opt-in') {
// TODO: disable cookies
}
if (type == 'opt-out') {
// TODO: enable cookies
}
},
"content": {
"href": "http://www.eclipse.org/legal/privacy.php"
}
})});
</script>
END Cookie Consent -->
</head>
<body>
<!-- Navbar -->
<div class="navbar navbar-fixed-top"
style="border-bottom: 1px solid #000;">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse"> <span class="icon-bar"></span> <span
class="icon-bar"></span> <span class="icon-bar"></span>
</a> <a class="brand" href="/xtend/index.html"></a>
<div class="nav-collapse collapse" style="height: 0px;">
<ul class="nav">
<li ><a href="/xtend/download.html">Download</a></li>
<li ><a href="/xtend/documentation/index.html">Documentation</a></li>
<li ><a href="/xtend/community.html">Community</a></li>
<li ><a href="http://xtext.org">Xtext</a></li>
<li ><a href="http://www.eclipse.org">Eclipse.org</a></li>
</ul>
<!--div class="btn-group pull-right">
<div class="g-plusone" data-href="http://www.xtend-lang.org"></div>
</div-->
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Navbar End -->
<div id="page">
<div class="inner">
<div class="container">
<br/>
<div>
<h3>Table of Contents</h3>
<ul>
<li><p><a href="#/releasenotes/2018/05/23/version-2-14-0">Xtend 2.14.0 Release Notes &mdash; May 23, 2018</a></p>
<li><p><a href="#/releasenotes/2017/10/20/version-2-13-0">Xtext 2.13.0 Release Notes &mdash; Oct 20, 2017</a></p>
<li><p><a href="#/releasenotes/2017/02/01/version-2-11-0">Xtend 2.11.0 Release Notes &mdash; Feb 1, 2017</a></p>
<li><p><a href="#/releasenotes/2015/12/01/version-2-9-0">Xtend 2.9.0 Release Notes &mdash; Dec 1, 2015</a></p>
<li><p><a href="#/releasenotes/2015/03/11/version-2-8-0">Xtend 2.8.0 Release Notes &mdash; Mar 11, 2015</a></p>
<li><p><a href="#/releasenotes/2014/09/02/version-2-7-0">Xtend 2.7.0 Release Notes &mdash; Sep 2, 2014</a></p>
<li><p><a href="#/releasenotes/2014/05/21/version-2-6-0">Xtend 2.6.0 Release Notes &mdash; May 21, 2014</a></p>
<li><p><a href="#/releasenotes/2013/12/11/version-2-5-0">Xtend 2.5.0 Release Notes &mdash; Dec 11, 2013</a></p>
<li><p><a href="#/releasenotes/2013/09/04/version-2-4-3">Xtend 2.4.3 Release Notes &mdash; Sep 4, 2013</a></p>
</ul>
</div>
<hr/>
<section id="/releasenotes/2018/05/23/version-2-14-0">
<h1>Xtend 2.14.0 Release Notes<small>&nbsp;&nbsp;May 23, 2018</small></h1>
<br/>
<h2 id="java-9-and-10-support">Java 9 and 10 Support</h2>
<p>Xtext and Xtend 2.14 are able to compile with and against Java 10. Here are a few notes on the Support</p>
<ul>
<li>There is no native support for Java 9/10 module visibilities but we fall back to jdt/javac on that topic.</li>
</ul>
<h2 id="compiler">Compiler</h2>
<h3 id="avoid-generation-of-unnecessary-exception-variables">Avoid generation of unnecessary exception variables</h3>
<p>When an exception variable is not used within a catch block, the transpiled Java code contained an unused variable.</p>
<p>Considering the following Xtend snippet:</p>
<pre><code>try {
... some code ...
} catch (SomeException e) {
// do nothing with "e"
}
</code></pre>
<p>The catch block was transpiled to:</p>
<pre><code>catch (final Throwable _t) {
if (_t instanceof SomeException) {
final SomeException e = (SomeException)_t;
} else {
throw Exceptions.sneakyThrow(_t);
}
}
</code></pre>
<p>Xtend will now avoid the generation of the variable when it is not used within the catch block:</p>
<pre><code>catch (final Throwable _t) {
if (_t instanceof SomeException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
</code></pre>
<h3 id="multi-catch-support">Multi-Catch Support</h3>
<p>With Xtend 2.14 the exception handling supports multi-catch clauses.</p>
<p><img src="/xtend/images/releasenotes/2_14_0_xtend-multi-catch-new.png" alt="" /></p>
<p>The multi-catch clause can handle an arbitrary number of exceptions separated by “|”. <br />
Within the catch block, the intersection exception type of the exceptions caught by the multi-catch statement is available for further processing.<br />
Multi-catch support leads to semantically rich and more concise catch statements.</p>
<h3 id="multi-type-guard-support">Multi-Type Guard Support</h3>
<p>The type guard feature in switch statements is enhanced by support for testing multiple types in one case statement.</p>
<p><img src="/xtend/images/releasenotes/2_14_0_xtend-multi-type-guard-new.png" alt="" /></p>
<p>As for the multi-catch statements the different types handled by a single case statement are separated by “|”.<br />
The intersection type of the types specified in the multi-type guard statement is available within the case block.</p>
<h2 id="unnecessary-modifiers-validation">Unnecessary Modifiers Validation</h2>
<p>Xtend detects unnecessary modifiers in code, e.g. the <code>public</code> modifier on types. By default issues of this kind are raised as warnings, the severity level is configurable.</p>
<p><img src="/xtend/images/releasenotes/2_14_unnecessary_modifier.png" alt="" /></p>
<p>For convenient resolution of these issues a quick fix has been added.</p>
<h2 id="eclipse-integration">Eclipse Integration</h2>
<h3 id="organize-imports">Organize Imports</h3>
<p>The Organize Imports feature has been improved to consider inner types properly.</p>
<h2 id="links">Links</h2>
<ul>
<li><a href="https://blogs.itemis.com/en/xtend-2-14-unnecessary-modifiers-validation">“Unnecessary modifiers validation” blog post</a></li>
</ul>
<h2 id="fixed-issues">Fixed Issues</h2>
<p>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:</p>
<ul>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Aissue+milestone%3ARelease_2.14+is%3Aclosed+repo%3Aeclipse%2Fxtext+repo%3Aeclipse%2Fxtext-core+repo%3Aeclipse%2Fxtext-lib+repo%3Aeclipse%2Fxtext-extras+repo%3Aeclipse%2Fxtext-eclipse+repo%3Aeclipse%2Fxtext-idea+repo%3Aeclipse%2Fxtext-web+repo%3Aeclipse%2Fxtext-maven+repo%3Aeclipse%2Fxtext-xtend&amp;type=Issues&amp;ref=searchresults">Fixed GitHub issues</a></p>
</li>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Apr+milestone%3ARelease_2.14+is%3Aclosed+repo%3Aeclipse%2Fxtext+repo%3Aeclipse%2Fxtext-core+repo%3Aeclipse%2Fxtext-lib+repo%3Aeclipse%2Fxtext-extras+repo%3Aeclipse%2Fxtext-eclipse+repo%3Aeclipse%2Fxtext-idea+repo%3Aeclipse%2Fxtext-web+repo%3Aeclipse%2Fxtext-maven+repo%3Aeclipse%2Fxtext-xtend&amp;type=Issues&amp;ref=searchresults">Closed Pull Requests</a></p>
</li>
<li>
<p><a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;classification=Modeling&amp;classification=Tools&amp;columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cresolution%2Cshort_desc%2Cchangeddate%2Ckeywords&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;known_name=Xtext%202.14&amp;list_id=16618269&amp;product=TMF&amp;product=Xtend&amp;query_based_on=Xtext%202.14&amp;query_format=advanced&amp;status_whiteboard=v2.14&amp;status_whiteboard_type=allwordssubstr">Fixed Eclipse Bugzilla tickets</a></p>
</li>
</ul>
</section>
<hr/>
<section id="/releasenotes/2017/10/20/version-2-13-0">
<h1>Xtext 2.13.0 Release Notes<small>&nbsp;&nbsp;Oct 20, 2017</small></h1>
<br/>
<h3 id="xtend-213-is-out">Xtend 2.13 is out</h3>
<p>Xtend 2.13 is mainly a bugfix release.</p>
<h2 id="fixed-issues">Fixed Issues</h2>
<p>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:</p>
<ul>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Aissue+milestone%3ARelease_2.13+is%3Aclosed+repo%3Aeclipse%2Fxtext+repo%3Aeclipse%2Fxtext-core+repo%3Aeclipse%2Fxtext-lib+repo%3Aeclipse%2Fxtext-extras+repo%3Aeclipse%2Fxtext-eclipse+repo%3Aeclipse%2Fxtext-idea+repo%3Aeclipse%2Fxtext-web+repo%3Aeclipse%2Fxtext-maven+repo%3Aeclipse%2Fxtext-xtend&amp;type=Issues&amp;ref=searchresults">Fixed GitHub issues</a></p>
</li>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Apr+milestone%3ARelease_2.13+is%3Aclosed+repo%3Aeclipse%2Fxtext+repo%3Aeclipse%2Fxtext-core+repo%3Aeclipse%2Fxtext-lib+repo%3Aeclipse%2Fxtext-extras+repo%3Aeclipse%2Fxtext-eclipse+repo%3Aeclipse%2Fxtext-idea+repo%3Aeclipse%2Fxtext-web+repo%3Aeclipse%2Fxtext-maven+repo%3Aeclipse%2Fxtext-xtend&amp;type=Issues&amp;ref=searchresults">Closed Pull Requests</a></p>
</li>
<li>
<p><a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;classification=Modeling&amp;classification=Tools&amp;columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cresolution%2Cshort_desc%2Cchangeddate%2Ckeywords&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;known_name=Xtext%202.13&amp;list_id=16618269&amp;product=TMF&amp;product=Xtend&amp;query_based_on=Xtext%202.13&amp;query_format=advanced&amp;status_whiteboard=v2.13&amp;status_whiteboard_type=allwordssubstr">Fixed Eclipse Bugzilla tickets</a></p>
</li>
</ul>
</section>
<hr/>
<section id="/releasenotes/2017/02/01/version-2-11-0">
<h1>Xtend 2.11.0 Release Notes<small>&nbsp;&nbsp;Feb 1, 2017</small></h1>
<br/>
<p>Xtend version 2.11 comes with a new source repository and plenty of improvements and bug fixes.</p>
<h2 id="new-source-repository">New Source Repository</h2>
<p>The Xtend code base has been moved to a dedicated repository <a href="https://github.com/eclipse/xtext-xtend">xtext-xtend</a> in the course of the restructuring of Xtext (see the <a href="https://www.eclipse.org/Xtext/releasenotes.html">Xtext 2.11.0 Release Notes</a>).</p>
<h2 id="the-xtend-language-and-library">The Xtend Language and Library</h2>
<h3 id="string-concatenation-performance-improvements">String Concatenation Performance Improvements</h3>
<p>The performance of string concatenation, e.g. as used for rich strings, <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=427909">has been improved</a>. 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 <a href="https://github.com/eclipse/xtext-xtend/issues/122">compatibility problems</a>.</p>
<h3 id="improved-compiler">Improved Compiler</h3>
<p>The Java code produced by the Xtend compiler is now <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=492072">less verbose and more readable</a>. For many situations Xtend does not produce synthetic variables anymore.</p>
<p>For <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=501975">switch statements on Strings</a> an additional null guard is produced. This lead to NPEs when a null argument was passed to the switch statement.</p>
<p><img src="/xtend/images/releasenotes/2_11_xbase-switch-nullguard.png" alt="" /></p>
<p>A for-loop over an array resulted in uncompilable Java code. This has been <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=440006">fixed</a>.</p>
<h3 id="comparison-with-null">Comparison with null</h3>
<p>For comparison expressions with <code>null</code> as argument it is more efficient to use the triple (not) equals operator <code>===</code> and <code>!==</code> instead of <code>==</code> and <code>!=</code>. While the “normal” operators will result in a call of <code>Objects.equal</code>, the triple equals operator can perform a direct comparison.</p>
<p><img src="/xtend/images/releasenotes/2_11_xbase-compare-null-gen.png" alt="" /></p>
<p>For these situations <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=401012">a warning is produced</a> and <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=403018">a quickfix is offered</a>.</p>
<p><img src="/xtend/images/releasenotes/2_11_xbase-compare-null-quickfix.png" alt="" /></p>
<h2 id="new-class-wizard">New Class Wizard</h2>
<p>The New Xtend Class wizard has an option to create a main method.</p>
<p><img src="/xtend/images/releasenotes/2_11_xtend-new-main-class.png" alt="" /></p>
</section>
<hr/>
<section id="/releasenotes/2015/12/01/version-2-9-0">
<h1>Xtend 2.9.0 Release Notes<small>&nbsp;&nbsp;Dec 1, 2015</small></h1>
<br/>
<p>Version 2.9 adds support for IntelliJ and includes many bug fixes. (<a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;list_id=11217573&amp;query_format=advanced&amp;status_whiteboard=v2.9&amp;status_whiteboard_type=allwordssubstr">full bugzilla list</a>).</p>
<h2 id="intellij-idea-support">IntelliJ IDEA support</h2>
<p>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.</p>
<p><img src="/xtend/images/releasenotes/2_9_0_intellij_new_xtend_type.png" alt="" /><br />
Create a new Xtend type (class, interface, or enum) inside Java packages.</p>
<p><img src="/xtend/images/releasenotes/2_9_0_intellij_editor.png" alt="" /><br />
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.</p>
<h2 id="android-studio-support">Android Studio Support</h2>
<p>Xtend now supports <a href="http://developer.android.com/tools/revisions/studio.html">Android Studio</a>, which uses IntelliJ IDEA as a foundation. This is not to be confused with the <a href="http://developer.android.com/tools/help/adt.html">Android Developer Tools</a>, which are based on Eclipse and which have been supported by Xtend since the very beginning.</p>
<p>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.</p>
</section>
<hr/>
<section id="/releasenotes/2015/03/11/version-2-8-0">
<h1>Xtend 2.8.0 Release Notes<small>&nbsp;&nbsp;Mar 11, 2015</small></h1>
<br/>
<p>Version 2.8 got many new features, bug fixes, and performance improvements (<a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;list_id=11217573&amp;query_format=advanced&amp;status_whiteboard=v2.8&amp;status_whiteboard_type=allwordssubstr">full bugzilla list</a>).</p>
<p>The most noteworthy changes are the following.</p>
<h2 id="target-java-version">Target Java Version</h2>
<p>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 (<em>Java → Compiler → Source compatibility</em>), which is in turn usually set to the same version as the <em>compiler compliance level</em>. The Xbase compiler settings can be configured in the <em>Compiler</em> preference page or project properties page of your Xbase language.</p>
<p><img src="/xtend/images/releasenotes/2_8_xbase-java-version.png" alt="" /></p>
<p>By unchecking <em>Use source compatibility level from Java settings</em>, 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.</p>
<h3 id="java-5">Java 5</h3>
<p>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.</p>
<h3 id="java-6">Java 6</h3>
<p>When the Xtend compiler is set to at least Java 6, it generates an <code>@Override</code> annotation to each method that overrides a method from a superclass or implements an interface method.</p>
<h3 id="java-7">Java 7</h3>
<p>Xtend expressions like <code>switch (obj) { ... }</code> where <code>obj</code> is of type <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html">String</a> are translated to Java <code>switch</code> statements (see <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/language/strings-switch.html">Strings in switch Statements</a>).</p>
<p>In Xtend you can write number literals in the form <code>2_147_483_647</code> to enhance their readability. This is also <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/language/underscores-literals.html">supported by Java 7</a>. When the Xtend compiler is set to at least Java 7, underscores in number literals are retained in the generated code.</p>
<h3 id="java-8">Java 8</h3>
<p><a href="/xtend/documentation/203_xtend_expressions.html#lambdas">Xtend lambda expressions</a> like <code>[String s | s.toLowerCase]</code> are translated to <a href="http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html">Java 8 lambda expressions</a>, e.g. <code>(String s) -&gt; return s.toLowerCase();</code>. More details on this translation are discussed in <a href="http://spoenemann.blogspot.de/2015/02/xtend-for-java-8.html">this blog post</a>.</p>
<p>Note that independent of which Java version is chosen for the generated code, Xtend works perfectly with the <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/language/lambda_api_jdk8.html">lambda-optimized Java 8 API</a> because Xtend lambdas are fully compatible with Java 8 lambdas.</p>
<p>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 <a href="http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html">Java 8 default method</a>.</p>
<h2 id="more-compiler-options">More Compiler Options</h2>
<p>You can now disable the automatic generation of <code>@SuppressWarnings</code> annotations for generated classes. Furthermore, you can enable the generation of <code>@Generated</code> 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.</p>
<h2 id="enhancements-of-the-xtend-editor">Enhancements of the Xtend Editor</h2>
<h3 id="open-generated-file">Open Generated File</h3>
<p>You can open the Java file that was generated from Xtend by right-clicking the Xtend editor and selecting <em>Open Generated File</em>.</p>
<p><img src="/xtend/images/releasenotes/2_8_xbase-open-generated.png" alt="" /></p>
<h3 id="open-inferred-type">Open Inferred Type</h3>
<p>You can open the declaration of the inferred type of a local variable by <em>Ctrl</em>-clicking (<em>Cmd</em> on Mac) the variable name.</p>
<p><img src="/xtend/images/releasenotes/2_8_open-inferred-type.png" alt="" /></p>
<h3 id="improved-hover-for-annotations">Improved Hover for Annotations</h3>
<p>Hovers of annotated members have been improved and allow to navigate to annotation values.</p>
<h3 id="unique-class-name-validation">Unique Class Name Validation</h3>
<p>If your Xtend type’s qualified name collides with another Java or Xtend type in the same project you now get an error.</p>
<h2 id="convert-java-to-xtend">Convert Java to Xtend</h2>
<p>The new version features a Java-to-Xtend converter. Right-click a Java file, package or source folder in the Package Explorer and select <em>Convert to Xtend</em>. 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 <code>FIXME</code> comments in the Xtend code. However, the converter is able to convert the majority of Java classes without problems.</p>
<p><img src="/xtend/images/releasenotes/2_8_java-convert-to-xtend.png" alt="" /></p>
<h2 id="active-annotations">Active Annotations</h2>
<h4 id="constant-field-initializer">Constant Field Initializer</h4>
<p><em>MutableFieldDeclaration</em> now features a set of methods like <code>setConstantValueAsInt(int value)</code> for creating static final fields with constant initializers. All primitive values as well as <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html">String</a> are supported.</p>
<h4 id="default-methods">Default Methods</h4>
<p>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 <em>abstract</em> flag on the <em>MutableMethodDeclaration</em>.</p>
<h2 id="faster-builds-and-more-responsive-ui">Faster Builds and More Responsive UI</h2>
<p>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.</p>
<p>Into the bargain, user actions like saving an editor now cancel the auto-build and are no longer blocked by it.</p>
</section>
<hr/>
<section id="/releasenotes/2014/09/02/version-2-7-0">
<h1>Xtend 2.7.0 Release Notes<small>&nbsp;&nbsp;Sep 2, 2014</small></h1>
<br/>
<p>
Version 2.7 got many new features, bug fixes and performance improvements (<a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&status_whiteboard=v2.7">full bugzilla list</a>). The most noteworthy changes are the following.
</p>
<section id="xtend_language_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Language
</h3>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Sugared Lambdas With Zero And More Than Two Arguments
</h4>
<p>
It is now allowed to leave out parameter declarations for all lambda expressions using a positional syntax, similar to Apple's Swift:
<pre class="prettyprint lang-xtend linenums">
#[1, 2, 3].reduce[$0 + $1]
</pre>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Unqualified Enum Usage
</h4>
Enum constants in annotations and switch expressions can be referenced without their type name.
<pre class="prettyprint lang-xtend linenums">
@Retention(RUNTIME)
</pre>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Inner Type of Parameterized Types
</h4>
Type inference for parameterized inner classes was improved and supports types like
<pre class="prettyprint lang-xtend linenums">
OuterType&LT;T&GT;.InnerType
</pre>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Deprecated and Dead Code Analysis
</h4>
The validator will now detect use of deprecated API and is much better at finding dead code. Would you have spotted the following?
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-dead-code-analysis.png"/>
<img>
</section>
<section id="xtend_library_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Library
</h3>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
New Extension Methods on Iterables
</h4>
<p>
The standard library has new extension methods for <code>Iterables</code>, including <code>min</code>/<code>max</code>, <code>groupBy</code> and <code>indexed</code>.
</p>
<pre class="prettyprint lang-xtend linenums">
#["Xtend", "Java", "Eclipse"].maxBy[length]
</pre>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
New Active Annotations
</h4>
<p>New Active Annotations have been added to free you of some repetitive tasks. The new <code>@Accessors</code> generates getters and setters, with fine grained control and even for all fields of a class if you want. The <code>@Delegate</code> 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:</p>
<pre class="prettyprint lang-xtend linenums">
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
}
</pre>
<p>Other additions include <code>@ToString</code>, <code>@EqualsHashCode</code>, <code>@FinalFieldsConstructor</code> and a new <code>@Data</code> (the old one is now deprecated as well as <code>@Property</code>).</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Active Annotations API Improvements
</h4>
<p>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.</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h3>IDE Features</h3>
</section>
<section id="xtend_debugging_2_7" style="padding-top: 68px; margin-top: -68px;">
<h4>
Debugging
</h4>
<p>
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.
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-conditional-breakpoint.png"/>
<p>
Breakpoints can now be toggled, enabled/disabled and inspected via the ruler context menu.
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtext-breakpoint-toggle.png"/>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Content Assist
</h4>
<p>
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.
</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Performance Improvements
</h4>
<p>
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.
</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Outline with Java-Mode
</h4>
<p>
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.
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-outline-normal.png"/>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-outline-jvm.png"/>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Organize imports on packages
</h4>
<p>
You can now use "Organize Xtend Imports" on whole packages via the "Source" context menu.
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-organize-imports.png"/>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Template proposals support import
</h4>
<p>
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.
</p>
<img class="image_between_p" src="images/releasenotes/2_7_xtend-templates-import.png"/>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Open return type
</h4>
<p>
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.
</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>
Show errors from derived Java files
</h4>
<p>
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.
</p>
</section>
<section style="padding-top: 68px; margin-top: -68px;">
<h4>Maven and Java 8</h4>
<p>
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.
</p>
</section>
</section>
<hr/>
<section id="/releasenotes/2014/05/21/version-2-6-0">
<h1>Xtend 2.6.0 Release Notes<small>&nbsp;&nbsp;May 21, 2014</small></h1>
<br/>
<p>
Version 2.6 got many bug fixes and performance improvements (<a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&status_whiteboard=v2.6">full bugzilla list</a>). The new features are the following.
</p>
<section id="anonymous_classes" style="padding-top: 68px; margin-top: -68px;">
<h3>Anonymous Classes</h3>
<p>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:</p>
<pre class="prettyprint lang-xtend linenums">
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
}
};
</pre>
</section>
<section id="static_nested_classes" style="padding-top: 68px; margin-top: -68px;">
<h3>Static Nested Classes</h3>
<p>Xtend now supports static nested classes.</p>
<pre class="prettyprint lang-xtend linenums">
class A {
static class NestedClass {
}
}
</pre>
</section>
<section id="operator_declaration" style="padding-top: 68px; margin-top: -68px;">
<h3>Operator Declarations</h3>
<p>In addition to overloading operators by adhering to the name mappings, listed in <a href="/xtend/documentation/203_xtend_expressions.html#operators">the documentation</a>,
one can now use the actual operator in the declaration as well.</p>
<pre class="prettyprint lang-xtend linenums">
class Money {
def + (Money other) { ... }
def - (Money other) { ... }
def * (BigDecimal times) { ... }
...
}
</pre>
</section>
<section id="synchronized_expression" style="padding-top: 68px; margin-top: -68px;">
<h3>Synchronized Expression</h3>
<p>
The synchronized expression works basically like Java's synchronized statement.
</p>
<pre class="prettyprint lang-xtend linenums">
synchronized(lock) {
// do stuff
}
</pre>
<p>
But of course it is an expression, as everything in Xtend/Xbase. So you can write the following as well:
</p>
<pre class="prettyprint lang-xtend linenums">
someMethodCall(synchronized(lock) { ... })
</pre>
</section>
<section id="qualified_static_imports" style="padding-top: 68px; margin-top: -68px;">
<h3>Qualified Static Imports</h3>
<p>It is now possible to import features in a fully qualified way. This works for regular static imports as well as for extension imports.</p>
<pre class="prettyprint lang-xtend linenums">
// static import
import static java.util.Collections.singleton
// extension import
import static extension java.util.Collections.min
import static extension java.util.Collections.max
</pre>
</section>
<section id="switch_fall_through" style="padding-top: 68px; margin-top: -68px;">
<h3>Switch Fall Through</h3>
<p>The switch expression now supports a kind of fall through. Here's an example</p>
<pre class="prettyprint lang-xtend linenums">
switch myOperator {
case '+',
case '-' : handlePlusMinus()
case '*',
case '/' : handleDivMultiply()
default : throw new IllegalStateException
}
</pre>
</section>
<section id="compound_assignments" style="padding-top: 68px; margin-top: -68px;">
<h3>Compound Assignments</h3>
<p>Xtend now supports compound assignment operators.</p>
<pre class="prettyprint lang-xtend linenums">
var i = 0
i += 42
</pre>
<p>Compound operators work on overloaded operators as well. That is you don't need to declare '+=' if you have '+' defined.
Example:</p>
<pre class="prettyprint lang-xtend linenums">
var distance = 15.km
distance += 5.km
</pre>
</section>
<section id="postfix_operators" style="padding-top: 68px; margin-top: -68px;">
<h3>Postfix Operators</h3>
<p>Postfix operators for incrementing and decrementing numbers have been added.</p>
<pre class="prettyprint lang-xtend linenums">
var i = 0
while (condition()) {
i++
}
</pre>
</section>
<section id="traditional_for_loop" style="padding-top: 68px; margin-top: -68px;">
<h3>Traditional For-Loop</h3>
<p>The traditional for-loop from Java is now available in Xtend, too.</p>
<pre class="prettyprint lang-xtend linenums">
for (var i = 0; i < 99; i++) {
println(''+i+' bottles of beer on the wall.')
}
</pre>
</section>
<section id="multivalued_annotation_sugar" style="padding-top: 68px; margin-top: -68px;">
<h3>Multivalued Annotations Sugar</h3>
<p>Instead of writing </p>
<pre class="prettyprint lang-xtend linenums">
@SurpressWarnings(#["unused", "unchecked"])
</pre>
<p> you can write</p>
<pre class="prettyprint lang-xtend linenums">
@SurpressWarnings("unused", "unchecked")
</pre>
</section>
<section id="active_annotation_mark_as_read" style="padding-top: 68px; margin-top: -68px;">
<h3>Active Annotations - Flag fields as read resp. initialized</h3>
<p>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.</p>
</section><section id="style_checks" style="padding-top: 68px; margin-top: -68px;">
<h3>Style Checks</h3>
<p>2.6 adds the following optional compiler checks (inactive by default):</p>
<h4>Force return expression</h4>
<img class="image_between_p" src="images/releasenotes/2_6_0_validation-explicit-return.png"/>
<h4>Force declare return types</h4>
<img class="image_between_p" src="images/releasenotes/2_6_0_validation-explicit-return-declaration.png"/>
<h4>Force empty parenthesis on method invocation</h4>
<img class="image_between_p" src="images/releasenotes/2_6_0_validation-empty-parenthesis.png"/>
</section>
<section id="task_tags" style="padding-top: 68px; margin-top: -68px;">
<h3>Task Tags</h3>
<p>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.</p>
<img class="image_between_p" src="images/releasenotes/2_6_0_task_markers.png"/>
</section>
<section id="open_implementation" style="padding-top: 68px; margin-top: -68px;">
<h3>Open Implementation</h3>
<p>In addition to the "Go to declaration"-action, you can now navigate to existing implementations of a method. It works just like in JDT</p>
<img class="image_between_p" src="images/releasenotes/2_6_0_open_implementation.png"/>
</section>
<section id="debug_hover" style="padding-top: 68px; margin-top: -68px;">
<h3>Debug Hover Shows Inspect Dialog</h3>
<p>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.</p>
<img class="image_between_p" src="images/releasenotes/2_6_0_debug_hover_variable.png"/>
</section>
<section id="hover_annotations" style="padding-top: 68px; margin-top: -68px;">
<h3>Hover Shows Annotations</h3>
<p>The declaration hover now includes the annotations.</p>
<img class="image_between_p" src="images/releasenotes/2_6_0_annotations_in_hover.png"/>
</section>
<section id="gradle_plugin" style="padding-top: 68px; margin-top: -68px;">
<h3>Gradle Plug-in</h3>
<p>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. <br/>
The gradle plug-in is hosted <a href="https://github.com/oehme/xtend-gradle-plugin">at github</a>. </p>
<pre class="prettyprint lang-xtend linenums">
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.xtend:xtend-gradle-plugin:0.0.8'
}
}
apply plugin: 'xtend'
repositories {
mavenCentral()
}
dependencies {
//or testCompile if you only want to use Xtend for some tests
compile 'org.eclipse.xtend:org.eclipse.xtend.lib:2.6.0'
}
</pre>
</section>
<section id="android_lib" style="padding-top: 68px; margin-top: -68px;">
<h3>Treeshaken Lib for Android</h3>
<p>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.</p>
<p>The library can be <a href="http://search.maven.org/#search%7Cga%7C1%7Corg.eclipse.xtext.xbase.lib.slim">downloaded from maven central</a>.</p>
</section>
</section>
<hr/>
<section id="/releasenotes/2013/12/11/version-2-5-0">
<h1>Xtend 2.5.0 Release Notes<small>&nbsp;&nbsp;Dec 11, 2013</small></h1>
<br/>
<p>
With over <a href="http://goo.gl/7zorrn">100 bugfixes</a>, 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.
</p>
<section id="annotations_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Full support for Java 7 Annotations</h3>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
annotation Columns {
Column[] value = #[ @Column('id') ]
}
annotation Column {
String value
int length = 2 << 16
}
</pre>
<pre class="prettyprint lang-xtend linenums">
class Entity {
@Columns(#[@Column('id'), @Column(value = 'timestamp', length = 2 * 3 * 7)])
CompositeKey key
}
</pre>
</section>
<section id="compiler_checks_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Improved compiler checks</h3>
<p>
The Xtend compiler now detects ambiguously overloaded methods.
</p>
<h3 id="ambiguous_methods">Method overload validation</h4>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
class A {
def isCheck() {..}
}
class B extends A {
def m() {
/*
* Ambiguous feature call.
* The methods
* getCheck() in B and
* isCheck() in A
* both match.
*/
this.check
}
def getCheck() {..}
}
</pre>
<em>Important note:</em>
<p>
You have to make sure to use the library in version 2.5 along with the introduced compiler checks.
</p>
<h3 id="discouraged_variable_names">Discouraged variable names</h4>
<p>
Some variable names are used implicitely by Xtend, for example the variable name 'self'.
The compiler optionally reports if these names were picked manually.
</p>
</section>
<section id="language_enhancements_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Small language enhancements</h3>
<p>
Some refinements have been made to the Xtend language semantics to improve the overall experience.
</p>
<h3 id="improved_auto_casts">Auto casts</h4>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
def m(CharSequence c) {
if (c instanceof String) {
c.substring(42)
}
}
</pre>
<h3 id="switch_enum">Switch over enums</h4>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
def m(RetentionPolicy p) {
switch p {
case CLASS: 1
case RUNTIME: 2
case SOURCE: 3
}
}
</pre>
</section>
<section id="template_expression_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Customizable template expression</h3>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
def StringConcatenationClient m() '''my template''' // uses target type
// caller code
val result = new StringConcatenation(lineDelimiter) // custom line delimiter or subtype
result.append(m)
return result.toString()
</pre>
</section>
<section id="primitive_types_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Improved type inference with primitive values</h3>
<p>
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.
</p>
</section>
<section id="mvn_android_2_5" style="padding-top: 68px; margin-top: -68px;">
<h3>Better experience with Maven and Android</h3>
<p>
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.
</p>
</section>
</section>
<hr/>
<section id="/releasenotes/2013/09/04/version-2-4-3">
<h1>Xtend 2.4.3 Release Notes<small>&nbsp;&nbsp;Sep 4, 2013</small></h1>
<br/>
<p>
The team is proud to present a release with
more than <a href="https://bugs.eclipse.org/bugs/buglist.cgi?o5=anywordssubstr&f1=OP&f0=OP&resolution=FIXED&classification=Modeling&classification=Tools&f4=CP&v5=kepler&query_format=advanced&j1=OR&f3=CP&bug_status=RESOLVED&bug_status=VERIFIED&f5=flagtypes.name&component=Backlog&component=Common&component=Core&component=Releng&component=Website&component=Xtext&component=Xtext%20Backlog&product=TMF&product=Xtend&list_id=4768360">450 bug fixes</a> and features.
</p>
<section id="android_development" style="padding-top: 68px; margin-top: -68px;">
<h3>Android Support</h3>
<p>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.
</p>
<h3 id="android_debugging">Debugging</h4>
<p>
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.
</p>
<h3 id="android_maven">Maven Archetype</h4>
<p>
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:
</p>
<pre class="prettyprint linenums">
mvn archetype:generate -DarchetypeGroupId=org.eclipse.xtend \
-DarchetypeArtifactId=xtend-android-archetype \
-DarchetypeCatalog=http://repo.maven.apache.org/maven2
</pre>
</section>
<section id="new_language_features" style="padding-top: 68px; margin-top: -68px;">
<h3>New Language Features</h3>
<p>
The following new features have been added to the Xtend language.
</p>
<h3 id="streamlined" >Streamlined Java syntax</h4>
<p>
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.
</p>
<p>
Here is an example for a static access of the generated methods in Android's ubiquitous R class:
</p>
<pre class="prettyprint lang-xtend linenums">
R.id.edit_message
// previously it was (still supported) :
R$id::edit_message
</pre>
<p>
Type literals can now be written even shorter. Let's say you want to filter a list by type:
</p>
<pre class="prettyprint lang-xtend linenums">
myList.filter(MyType)
// where previously you had to write (still supported) :
myList.filter(typeof(MyType)
</pre>
<p>
If you use the Java syntax (e.g. <i>MyType.class</i>), you'll get an error marker pointing you to the right syntax.
</p>
<h3 id="active_annotations" >Active Annotations (Provisional API)</h4>
<p>
<em>Active Annotations</em> 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. <a href="/xtend/documentation/204_activeannotations.html">Read more...</a>
</p>
<h3 id="collection_literals">Collection Literals and Arrays</h4>
<p>
Xtend now has literals for unmodifiable collections.
</p>
<pre class="prettyprint lang-xtend linenums">
val listOfWords = #["Hello", "Xtend"]
val setOfWords = #{"Hello", "Xtend"}
val mapOfWords = #{1->"Hello", 2->"Xtend"}
</pre>
<p>
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.
</p>
<pre class="prettyprint lang-xtend linenums">
val String[] arrayOfWords = #["Hello", "Xtend"]
</pre>
<p>
In addition to literals for arrays you can now also easily access and modify arrays
as well as create empty arrays of any size.
</p>
<pre class="prettyprint lang-xtend linenums">
val String[] arrayOfWords = newArrayOfSize(2)
arrayOfWords.set(0, 'Hello')
arrayOfWords.set(1, 'Xtend')
</pre>
<h3 id="interfaces_enums_annotations">Interfaces, Enums and Annotations</h4>
<p>
Interfaces, enumerations and annotation types can now be declared directly in Xtend.
</p>
<pre class="prettyprint lang-xtend linenums">
interface Container<T> {
def T findChild((T)=>boolean matcher)
}
enum Color {
RED, GREEN, BLUE
}
@Retention(RetentionPolicy::RUNTIME)
@Target(ElementType::TYPE)
annotation DependsOn {
Class&lt;? extends Target&gt; value
val version = "2.4.0" // type 'String' inferred
}
</pre>
<h3 id="extension_provider">Extension Provider</h4>
<p>
Extension methods allow to add new methods to existing types without modifying them.
Consider the omnipresent class <code class="prettyprint lang-java">java.lang.String</code>.
If you have to parse a string to a number, you could always write
</p>
<pre class="prettyprint lang-java linenums">
Integer::parseInt('42')
</pre>
<p>but what you actually think of is</p>
<pre class="prettyprint lang-xtend linenums">
'42'.parseInt
</pre>
<p>To make that possible, you simply import the class <code class="prettyprint lang-java">Integer</code> as a static extension:</p>
<pre class="prettyprint lang-xtend linenums">
import static extension java.lang.Integer.*
</pre>
<p>This enables to pass the base of the number as an argument, too:</p>
<pre class="prettyprint lang-xtend linenums">
'2A'.parseInt(16)
</pre>
Extension methods are available in other language such as C# as well, but Xtend can do better.
The new <em>Extensions Providers</em> render a former limitiation obsolete: In Xtend 2.4, fields,
parameters and local variables can provide extensions, too. <a href="/xtend/documentation/202_xtend_classes_members.html#extension-provider">Read more...</a>
<br><br>
<h3 id="sam_types">SAM Type Conversion</h4>
<p>
Lambda expressions now work with interfaces and classes with a single abstract method
(SAM types). For example, the <code class="prettyprint lang-java">AbstractIterator</code>
from the Guava library has a single abstract method
<code class="prettyprint lang-java">computeNext()</code>. A lambda can be used to implement that:
</p>
<pre class="prettyprint lang-xtend linenums">
val AbstractIterator&lt;Double&gt; infiniteRandomNumbers = [| Math::random]
</pre>
<h3 id="new_operators">New Operators</h4>
<p>
Some new operators have been added. In addition to the usual <code>==</code> and <code>!=</code>
operators which map to <code>Object.equals(Object)</code>, the operators <code>===</code> and
<code>!==</code> respectively can be used to test for identity equality.
<pre class="prettyprint lang-xtend linenums">
if (myObject === otherObject) {
println("same objects")
}
</pre>
<p>
Also new exclusive range operators have been introduced. In order to iterate over a list and
work with the index you can write:</p>
<pre class="prettyprint lang-xtend linenums">
for (idx : 0 ..&lt; list.size) {
println("("+idx+") "+list.get(idx))
}
</pre>
<p>
Or if you want to iterate backwards :</p>
<pre class="prettyprint lang-xtend linenums">
for (idx : list.size &gt;.. 0) {
println("("+idx+") "+list.get(idx))
}
</pre>
</section>
<section id="new_ide_features" style="padding-top: 68px; margin-top: -68px;">
<h3>New IDE Features</h3>
<p>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:
</p>
<blockquote>
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.
</blockquote>
<p>
The following new IDE features improve the editing experience significantly:
</p>
<dl>
<h3 id="organize_imports">Organize Imports</h4>
<p>
With the new release we have overhauled the <em>Organize imports</em> action. It
processes all kinds of imports, asks to resolve conflicts, and shortens qualified names
automatically.
</p>
<img class="image_between_p" src="images/releasenotes/organize_imports.png"/>
<h3 id="extract_method">Extract Method and Extract Local Variable</h4>
<p>
New refactorings have been added. You can now extract code into a new local variable
</p>
<img class="image_between_p" src="images/releasenotes/extract_local_variable.png"/>
<p>
or into a new method.
</p>
<img class="image_between_p" src="images/releasenotes/extract_method_refactoring.png"/>
<h3 id="suppression_followup">Supression of Follow-Up Errors</h4>
<p>
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.
</p>
<img class="image_between_p" src="images/releasenotes/follow_up_errors.png"/>
<h3 id="optional_errors">Optional Errors and Warnings</h4>
<p>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.</p>
<img class="image_between_p" src="images/releasenotes/issue_severities.png"/>
<h3 id="quickfixes">More Quickfixes</h4>
<p>
Xtend now offers to create missing fields, methods, and types through quick fix proposals.
</p>
<img class="image_between_p" src="images/releasenotes/quickfixes.png"/>
<h3 id="content_assist">Improved Content Assist</h4>
<p>
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.
</p>
<img class="image_between_p" src="images/releasenotes/content_assist.png"/>
<h3 id="formatter">Formatter</h4>
<p>
A configurable formatter which pretty prints and indents code idiomatically is now available.
</p>
<img class="image_between_p" src="images/releasenotes/formatter.png"/>
<img class="image_between_p" src="images/releasenotes/formatter_preferences.png"/>
<h3 id="javadoc">JavaDoc</h4>
<p>
An Xtend editor now has validation and content assist within JavaDoc comments.
</p>
<img class="image_between_p" src="images/releasenotes/javadoc_content_assist.png"/>
<h3 id="copy_qualifiedname">Copy Qualified Name</h4>
<p>
You can use <em>Copy Qualified Name</em> in the editor and the outline view to copy the name
of types, fields and methods into the clipboard.
</p>
<img class="image_between_p" src="images/releasenotes/copy_qualified_name.png"/>
</dl>
</section>
</section>
</div>
</div>
</div>
<footer class="site-footer">
<div id="extra">
<div class="container inner-footer">
<div class="row">
<div class="span6">
<h3 class="footer-links-header">Quick Links</h3>
<ul class="footer-links clearfix">
<li><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
<li><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
<li><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
<li><a href="http://www.eclipse.org/legal/">Legal</a></li>
</ul>
<ul class="footer-links clearfix">
<li><a href="http://www.eclipse.org">Eclipse Home</a></li>
<li><a href="http://marketplace.eclipse.org/">Market Place</a></li>
<li><a href="http://live.eclipse.org/">Eclipse Live</a></li>
<li><a href="http://www.planeteclipse.org/">Eclipse Planet</a></li>
</ul>
</div>
<div class="span6">
<!-- Social Media Links -->
<h3 class="footer-links-header"">Social Media</h3>
<ul class="footer-links clearfix">
<li>
<a href="https://twitter.com/xtendlang"><img src="/xtend/images/Twitter-bird-darkgray.png" class="img-responsive" style="margin-right: 5px;height: 1em;" alt="Twitter icon">@xtendlang on Twitter</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<a href="#" class="scrollup fadeOutRight animated" style="display: none;">ScrollUp</a>
<a href="http://dryicons.com/">Icons by http://dryicons.com</a>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/xtend/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="/xtend/js/bootstrap.min.js" type="text/javascript"></script>
<!-- include pretty-print files -->
<script src="/xtend/js/prettify.js" type="text/javascript" ></script>
<script src="/xtend/js/lang-xtend.js" type="text/javascript"></script>
<!-- Include the plug-in -->
<script src="/xtend/js/jquery.prettyPhoto.js" type="text/javascript"></script>
<script src="/xtend/js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="/xtend/js/custom.js" type="text/javascript"></script>
<!--script src="https://apis.google.com/js/platform.js" async defer></script-->
<!--script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', 'UA-2429174-4' ]);
_gaq.push([ '_trackPageview' ]);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl'
: 'http://www')
+ '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script-->
</footer>
</body>
</html>