blob: 6d0d1fc20a38cd48be26b3cf41ab73f5378837fa [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Xtend - Xtend 2.4.3 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 class="post">
<header class="post-header">
<h1 class="post-title">Xtend 2.4.3 Release Notes</h1>
<p class="post-meta">Sep 4, 2013</p>
</header>
<article class="post-content">
<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>
</article>
</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>