blob: f430bbf2905ac71a924b3194c6f9a053305a1e85 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Xtend - Xtend 2.6.0 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.6.0 Release Notes</h1>
<p class="post-meta">May 21, 2014</p>
</header>
<article class="post-content">
<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>
</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>