blob: 33d6f3b371e1ece5bdeb5b935ef94bb5aab3e2a5 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Xtext - Release Notes</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="The website of Eclipse Xtext, an open-source framework for development of programming languages and domain-specific languages">
<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="/Xtext/images/favicon.png">
<link href="/Xtext/css/bootstrap.css" rel="stylesheet" type='text/css'>
<link href="/Xtext/css/bootstrap-responsive.css" rel="stylesheet" type='text/css'>
<link href="/Xtext/css/shield-responsive.css" rel="stylesheet" type='text/css'>
<link href='/Xtext/css/fonts.css' rel='stylesheet' type='text/css'>
<link href="/Xtext/css/prettyPhoto.css" rel="stylesheet" media="screen" type='text/css'>
<link href="/Xtext/css/prettify.css" type="text/css" rel="stylesheet"/>
<link href="/Xtext/css/style.css" rel="stylesheet" type='text/css'>
<!-- cover flow -->
<link href="/Xtext/css/coverflow.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>
<header class="site-header">
<!-- Navbar -->
<div class="navbar navbar-fixed-top">
<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="/Xtext/index.html"></a>
<div class="nav-collapse collapse" style="height: 0px;">
<ul class="nav">
<!--li ><a href="/Xtext/news.html">News</a></li-->
<li ><a href="/Xtext/download.html">Download</a></li>
<li ><a href="/Xtext/documentation/index.html">Documentation</a></li>
<li ><a href="/Xtext/community.html">Community</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Support &amp; Trainings<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://www.itemis.com/en/xtext/support-and-team/" target="_blank">itemis</a></li>
<li><a href="https://typefox.io/trainings-2" target="_blank">TypeFox</a></li>
</ul>
</li>
<li ><a href="http://xtend-lang.org">Xtend</a></li>
</ul>
<!--div class="nav pull-right">
<li ><a><iframe src="https://ghbtns.com/github-btn.html?user=eclipse&repo=xtext&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe></a></li>
</div-->
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Navbar End -->
</header>
<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">Xtext 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/05/25/version-2-12-0">Xtext 2.12.0 Release Notes &mdash; May 25, 2017</a></p>
<li><p><a href="#/releasenotes/2017/02/01/version-2-11-0">Xtext 2.11.0 Release Notes &mdash; Feb 1, 2017</a></p>
<li><p><a href="#/releasenotes/2016/05/25/version-2-10-0">Xtext 2.10.0 Release Notes &mdash; May 25, 2016</a></p>
<li><p><a href="#/releasenotes/2015/11/16/version-2-9-0">Xtext 2.9.0 Release Notes &mdash; Nov 16, 2015</a></p>
<li><p><a href="#/releasenotes/2015/03/11/version-2-8-0">Xtext 2.8.0 Release Notes &mdash; Mar 11, 2015</a></p>
<li><p><a href="#/releasenotes/2014/09/02/version-2-7-0">Xtext 2.7.0 Release Notes &mdash; Sep 2, 2014</a></p>
<li><p><a href="#/releasenotes/2014/05/21/version-2-6-0">Xtext 2.6.0 Release Notes &mdash; May 21, 2014</a></p>
<li><p><a href="#/releasenotes/2013/12/11/version-2-5-0">Xtext 2.5.0 Release Notes &mdash; Dec 11, 2013</a></p>
</ul>
</div>
<hr/>
<section id="/releasenotes/2018/05/23/version-2-14-0">
<h1>Xtext 2.14.0 Release Notes<small>&nbsp;&nbsp;May 23, 2018</small></h1>
<br/>
<p>While the Xtext project has paid more attention on bug fixing for the past release, Xtext 2.14 is bringing a whole bunch of new features. This version is part of the Eclipse Photon (4.8) simultaneous release. An important focus was to keep up with the fast development pace of important technologies that Xtext is building on. Since its past release, Java 9 and 10 came out. Build technologies like Maven Tycho and Gradle were changed to support that, too. The Language Server Protocol is evolving rapidly. JUnit 5 is adopted by IDEs and build systems. And Xtext is now ready for all of them!</p>
<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 9 &amp; 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>
<li>A current Maven version is required (tested with 3.5)</li>
<li>When using Gradle, version 4.7 is required at least. The wizard will create projects accordingly.</li>
<li>Java 9 requires Tycho 1.1 or newer, Java 10 requires Tycho 1.2</li>
<li>Java 9 requires Oxygen.1a at least, Java 10 requires Oxygen.3a. Eclipse Photon works fine for both.</li>
<li>Java 10 requires the org.objectweb.asm library in version 6.1.1</li>
</ul>
<p>For upgrading existing project use the New Project Wizard to create a project with the desired settings and compare build relevant files (MANIFEST.MF, build.gradle, pom.xml, *.target) with the existing projects.</p>
<h2 id="junit-5-support">JUnit 5 Support</h2>
<p>Xtext now supports the JUnit 5 framework for writing tests. JUnit 5.1 or newer is required.</p>
<p>For new projects the project wizard’s advanced page allows to select the desired JUnit version.</p>
<p><img src="/Xtext/images/releasenotes/2_14_wizard_junit5.gif" alt="" /></p>
<p>Created test projects directly only depend on the JUnit 5 API artifact</p>
<pre><code>org.junit.jupiter:junit-jupiter-api:5.0.0
</code></pre>
<p>Additional dependencies are configured by the JUnit Library container. This lowers the coupling to concrete JUnit versions and the test engine used. For example, Eclipse Photon is using JUnit 5.1, while Eclipse Oxygen is using JUnit 5.0. Furthermore, the execution of tests in build systems is using the test engines provided by the build system’s test plugins.</p>
<h2 id="new-grammar-annotations">New Grammar Annotations</h2>
<p>The Xtext Grammar language supports the following additional annotations for parser rules:</p>
<h3 id="deprecated">@Deprecated</h3>
<p><img src="/Xtext/images/releasenotes/2_14_annotation_deprecated.png" alt="" /></p>
<p>This annotation marks a rule to be deprecated. Issue markers with are produced where a deprecated rule is used. By default the severity of issue is <em>Warning</em>. The severity level can be configured in the preferences. This feature will help you to do smooth langauage evolution of the time by informing your users about deprecated parts.</p>
<p><img src="/Xtext/images/releasenotes/2_14_annotation_preference.png" alt="" /></p>
<h3 id="final">@Final</h3>
<p><img src="/Xtext/images/releasenotes/2_14_annotation_final.png" alt="" /></p>
<p>A rule marked with <code>@Final</code> cannot be overridden.</p>
<h3 id="exported">@Exported</h3>
<p>As a default Xtext exports all elements to the index that have a name. For customizing this behaviour you need to create a custom IDefaultResourceDescriptionStrategy manually.<br />
With <code>@Exported</code> it can be customized on grammar level, which element types are exported to the index. The customization takes effect when at least one rule in a grammar is annotated with <code>@Exported</code>. By doing that you can easily manage visibility of elements and safe memory.</p>
<h2 id="eclipse-integration">Eclipse Integration</h2>
<h3 id="create-action-quickfix">Create Action Quickfix</h3>
<p>Rules that can be consumed without object instantiation usually require a <em>Create Action</em>. A typical example is when a rule defines an optional assignment. Xtext reports this as a warning in the grammar file.</p>
<p>For problems of this kind a new <em>quickfix</em> has been added that inserts the <em>Create Action</em> at the proper place of the parser rule.</p>
<p><img src="/Xtext/images/releasenotes/2_14_create-action.gif" alt="" /></p>
<h3 id="code-mining-support">Code Mining Support</h3>
<p>Eclipse Photon (4.8) adds a new API called <em>Code Mining</em>. With it text editors can inline additional semantic information into the text, which is not part of the text itself. A useful example to leverage this is to display names of inferred types, parameter names of a called function etc.</p>
<p>Xtext adds a new bundle <code>org.eclipse.xtext.ui.codemining</code> which is offering an API for usage of Code Mining with Xtext. The code generator fragment <code>org.eclipse.xtext.xtext.generator.ui.codemining.CodeMiningFragment</code> can be added to the generator workflow to create a stub implementation and provide all dependencies and bindings for the use of this API.</p>
<p>An example implementation has been added to the Domainmodel Example DSL. To learn more about the usage of this API install the example from the File menu and look up the <code>DomainmodelCodeMiningProvider</code> class.</p>
<p><img src="/Xtext/images/releasenotes/2_14_domainmodel-codemining.gif" alt="" /></p>
<h3 id="new-project-and-file-wizard">New Project and File Wizard</h3>
<p>With two simple switches you can turn on the generation of a New Project Wizard and a New File Wizard for your language.</p>
<p>These wizards are based on flexible templates to generate one or many projects with any number of files. You can enable the generation from your .mwe2 file with two simple switches:</p>
<pre><code>language = StandardLanguage {
name = "org.xtext.example.mydsl.MyDsl"
fileExtensions = "mydsl"
fileWizard = {
generate = true
}
projectWizard = {
generate = true
}
}
</code></pre>
<p>The wizard to create projects allows to select from a number of templates and creates one or, in certain situations helpful, even many projects.</p>
<p><img src="/Xtext/images/releasenotes/2_14_new-file-wizard.png" alt="" /></p>
<p>The wizard to create files is more simple in its basic form and skips the template selection if there is only one file template.</p>
<p><img src="/Xtext/images/releasenotes/2_14_new-project-wizard-template-selection.png" alt="" /></p>
<p>In case there are many templates the wizard gets a second page to configure the parameter whereas on the first page a combo box to select the template appears.</p>
<p>The UI for the parameters of the templates as well as the templates them self are defined in code with a concise API. You do not need to fiddle around with SWT widgets and get most UI stuff for free. The templates are generated in the UI project of your language. You can adapt the generated templates, add new ones or contribute new template providers through extension points.</p>
<p>If you generate the wizards for an existing project the <code>plugin.xml</code> is not regenerated to not risk loosing manual changes you might have applied. Instead a <code>plugin.xml_gen</code> is created. You have to merge the generated extensions to your <code>plugin.xml</code> manually.</p>
<h3 id="console-icon">Console Icon</h3>
<p>The Xtext icon has been added for the Xtext console:</p>
<p><img src="/Xtext/images/releasenotes/2_14_console-icon.png" alt="" /></p>
<h2 id="language-server-support">Language Server Support</h2>
<p>Xtext has been upgraded to LSP4J version 0.4.0. This includes the following features:</p>
<ul>
<li>Implementation of the Language Server Protocol 3.7.0</li>
<li>Implementation of the VS Code Debug Protocol 1.25.0</li>
<li>Support multiple local and remote services</li>
<li>Improved error handling</li>
</ul>
<h2 id="emf-support">EMF Support</h2>
<p>With EMF 2.14 a new registry <code>EAnnotationValidator.Registry.INSTANCE</code>, which had to be considered in Xtext’s testing support for resetting.</p>
<p>EMF 2.8 <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=367569#c7">introduced</a> the concept <code>ResourceLocator</code> in <code>ResourceSet</code>s. Xtext’s specialized implementation <code>XtextResourceSet</code> did not support that so far and has been extended now.</p>
<h2 id="change-serializer--rename-refactoring">Change Serializer &amp; Rename Refactoring</h2>
<p>The past <a href="/Xtext/releasenotes.html#/releasenotes/2017/10/20/version-2-13-0">release 2.13</a> introduced a new API for EMF Model Manipulation and an improved rename refactoring based on the new <code>IChangeSerializer</code> API.</p>
<p>These new features are still incubating. Several issues that were identified by the adoption of the features have been solved.</p>
<h2 id="performance">Performance</h2>
<h3 id="output-configurations-cache">Output Configurations Cache</h3>
<p>A performance bottleneck was <a href="https://github.com/eclipse/xtext-eclipse/issues/535">discovered</a> in the access to <code>IOutputConfiguration</code>s in builder participants. The problem depends on the amount of files produced by code generators.</p>
<p>A cache was introduced in class <code>BuilderParticipant</code> to solve the issue.</p>
<h3 id="semantic-highlighting">Semantic Highlighting</h3>
<p>Computation of semantic highlighting <a href="https://github.com/eclipse/xtext-eclipse/issues/347">was performed twice</a>. This was fixed and should improve editing experience especially for larger files with intensive use of semantic highlighting, for example like the Xtend language.</p>
<h3 id="queuedbuilddata">QueuedBuildData</h3>
<p>A bottleneck in class <code>QueuedBuildData</code> has been <a href="https://github.com/eclipse/xtext-eclipse/issues/40">found</a> that affects the build time for a large number of resources. The build time has been improved for this scenario.</p>
<h2 id="execution-environment">Execution Environment</h2>
<p>Xtext 2.14 comes with the following requirements for the execution environment:</p>
<ul>
<li>Java: 1.8, 9 or 10</li>
<li>Eclipse Luna (4.4) or newer</li>
<li>EMF 2.10 or newer</li>
<li>Guice 3.0</li>
<li>Tycho 1.1, 1.2 (Java 10 or JUnit 5)</li>
<li>JUnit 4.12 or 5.1</li>
</ul>
<p>Note that bundle <code>org.eclipse.xtext.xbase.lib</code> was compiled with Java 1.8 now, while being compatible to 1.6 in earlier versions.</p>
<h2 id="links">Links</h2>
<p>More detailed information on some topics have been written in blog posts:</p>
<ul>
<li><a href="https://blogs.itemis.com/en/xtext-2.14-adds-support-for-junit-5">“Xtext 2.14 adds support for JUnit 5”</a></li>
<li><a href="https://blogs.itemis.com/en/code-mining-support-in-xtext">“Code Mining Support in Xtext”</a></li>
<li><a href="https://blogs.itemis.com/en/generating-a-new-project-wizard-with-xtext-2.14">“Generating a new project wizard with Xtext 2.14”</a></li>
<li><a href="https://blogs.itemis.com/en/new-file-wizard-easy-to-generate-with-xtext-2.14">“New File Wizard – easy to generate with Xtext 2.14”</a></li>
<li><a href="https://blogs.itemis.com/de/new-project-wizard-einfach-mit-xtext-2-14-generieren">“New Project Wizard: einfach mit Xtext 2.14 generieren”</a> (German)</li>
<li><a href="https://blogs.itemis.com/de/new-file-wizard-einfach-mit-xtext-2.14-generieren">“Erzeugen des New File Wizards”</a> (German)</li>
<li><a href="https://github.com/eclipse/lsp4j/blob/master/CHANGELOG.md">LSP4J Changelog</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 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.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/>
<h2 id="language-server-support">Language Server Support</h2>
<h3 id="eclipse-new-project-wizard-language-server-build">Eclipse New Project Wizard: Language Server Build</h3>
<p>The New Project Wizard allows now to build an executable distribution of language server. On the advanced page a new option was added which is enabled when a Build System was selected. The option allows the selection of a distribution type:</p>
<ul>
<li><strong>Regular</strong>: A batch script is created that is used to start the server. The DSL jars and all of its runtime dependencies are copied to the output folder.</li>
<li><strong>Fat Jar</strong>: The language server is packaged in a single executable jar.</li>
</ul>
<p>Both Gradle and Maven are supported. When activated, the build script of the language’s Generic IDE project is extended and the language server is packaged to the project’s build</p>
<p><img src="/Xtext/images/releasenotes/2_13_project-wizard-ls.png" alt="" /></p>
<h2 id="eclipse-integration">Eclipse Integration</h2>
<h3 id="configuration-error-detection">Configuration Error Detection</h3>
<p>Invalid combinations of bundles are a frequent source of errors. This can be caused by an invalid mixture of Xtext’s UI and runtime plugins, or by DSL plugins developed with a different version of Xtext than used in the environment where it fails.</p>
<p>Although there can’t be done anything to get the plugins working on an invalid environment, the resulting failure messages were not good for the user, leaving an impression of an unstable framework.</p>
<p>When running in an error during the initial creation of Guice injectors in the DSL’s UI or Xtext’s Shared UI bundle, the error is catched and an analysis of the runtime environment is included in the failure message. This allows better analysis of the root cause.</p>
<h3 id="multi-quickfixes">Multi-Quickfixes</h3>
<p>These are quickfixes that allow to be applied to multiple markers at once.</p>
<p>TBD</p>
<h3 id="better-cancellation-in-refactorings">Better Cancellation in Refactorings</h3>
<p>You can how hit the cancel dialog in refactorings and it will actually cancel at the next opportunity and not at the end only.</p>
<h3 id="content-type-descriptor">Content Type Descriptor</h3>
<p>Xtext UI projects provide a Content Type Descriptor by contributing to the <a href="https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fruntime_content_contributing.htm"><code>org.eclipse.core.contenttype.contentTypes</code> extension point</a> to the <code>plugin.xml</code> file. This is affecting performance on text searches in Eclipse, since Eclipse can decide that a DSL file has no binary content based on the content type’s base type. (<a href="https://github.com/eclipse/xtext-eclipse/issues/379">xtext-eclipse/issues/379</a>)</p>
<pre><code>&lt;extension point="org.eclipse.core.contenttype.contentTypes"&gt;
&lt;content-type
base-type="org.eclipse.core.runtime.text"
file-extensions="mydsl"
id="org.eclipse.xtext.mydsl.MyDSL.contenttype"
name="MyDSL File"
priority="normal"&gt;
&lt;/content-type&gt;
&lt;/extension&gt;
</code></pre>
<h2 id="new-api">New API</h2>
<h3 id="emf-model-manipulation-api-incubating">EMF Model Manipulation API (incubating)</h3>
<p>The <code>IChangeSerializer</code> is a new API to listen to changes that are made to the EMF model of an XtextResource and serialize them back to the document’s text. It has a number of benefits to the old <code>XtextDocument.modify()</code> approach:</p>
<ul>
<li>Direct integration with the formatter, such that changes are automatically nicely formatted.</li>
<li>Minimum text region changes resulting in less noise.</li>
<li>Many points to hook into, e.g. for automatic update of an import section.</li>
<li>More ways to optimize for a specific language and to tune performance.</li>
<li>Independence from Eclipse-UI concepts like the <code>Document</code>. This makes it reusable in languages server implementations.</li>
</ul>
<p>You can use the <code>IChangeSerializer</code> for refactorings, semantic quickfixes, code lens etc. It still has a few limitations, e.g. it does not work with derived state models, that’s why we keep it provisional for now.</p>
<p>Nevertheless, we have added the following new features based on it:</p>
<h3 id="rename-participants-for-eclipse-file-operations">Rename Participants for Eclipse File Operations</h3>
<p>Some languages tie the model file name to the content, like the package declaration in Java. For such cases you might want to participate in operations on files or directories, like move, rename or paste, to adapt your models automatically. Based on the new <code>IChangeSerializer</code> we have implemented some generic file refactoring participants. You will get notified of such changes to react appropriately by registering your own <code>IResourceRelocationStrategy</code>.</p>
<pre><code>&lt;extension point="org.eclipse.xtext.ui.resourceRelocationStrategy"&gt;
&lt;strategy class="mydsl.MydslExecutableExtensionFactory:mydsl.MydslResourceRelocationStrategy"&gt;
&lt;/strategy&gt;
&lt;/extension&gt;
</code></pre>
<h3 id="alternative-rename-refactoring-for-xtext">Alternative Rename Refactoring for Xtext</h3>
<p>By enabling <code>useChangeSerializer</code> flag in the workflow of your language</p>
<pre><code>Workflow {
component = XtextGenerator {
...
language = StandardLanguage {
...
renameRefactoring = {
useChangeSerializer = true
...
</code></pre>
<p>you will use an new, alternative rename refactoring for Eclipse based on the <code>IChangeSerializer</code>. This flag will also generate the binding for the <code>IRenameService</code> and thereby enable rename refactoring on your language server.</p>
<h3 id="xbase-library-orgeclipsextextxbaselib">Xbase Library (<code>org.eclipse.xtext.xbase.lib</code>)</h3>
<h4 id="no-arg-overloads-to-all-mutable-collection-literals">No-arg overloads to all mutable collection literals</h4>
<p>Class <code>CollectionLiterals</code> was extended by no-arg methods for all mutable collection literals:</p>
<ul>
<li><code>newArrayList()</code></li>
<li><code>newHashMap()</code></li>
<li><code>newHashSet()</code></li>
<li><code>newLinkedHashMap()</code></li>
<li><code>newLinkedHashSet()</code></li>
<li><code>newLinkedList()</code></li>
</ul>
<p>Xtext’s code base was refactored to use these methods where appropriate. As a consequence Xtext requires at least version 2.13 of <code>org.eclipse.xtext.xbase.lib</code>. Therefore bundle manifests were refactored to constraint the library bundle’s lower version. New projects will automatically add the version constraint to manifests.</p>
<h4 id="flatmap-extension-method">flatMap extension method</h4>
<p>A new convenience method <code>flatMap</code> has been added to <code>IterableExtensions</code> and <code>IteratorExtensions</code>, which combines <code>map</code> and <code>flatten</code>.</p>
<pre><code>@FinalFieldsConstructor
@Accessors
class Planet {
final String name
final List&lt;Moon&gt; moons
}
@FinalFieldsConstructor
@Accessors
class Moon {
final String name
}
class Planets {
def static void main (String[] args) {
val Iterable&lt;Planet&gt; planets = #[
new Planet("Earth", #[new Moon ("Moon")]),
new Planet("Mars", #[new Moon ("Phobos"), new Moon("Deimos")])
]
val moonNames_old = planets.map[moons].flatten.map[name]
val moonNames_new = planets.flatMap[moons].map[name]
}
}
</code></pre>
<h2 id="tracing">Tracing</h2>
<p>Tracing can now be used for debugging in generated Java code as well. The <code>@Traced</code> annotation now takes optionally a <code>useForDebugging=true</code>. The <code>@TracedAccessors</code> are now adds to the <code>._&lt;feature&gt;()</code> extension method a <code>._&lt;feature&gt;(useForDebugging)</code> extension method.</p>
<h2 id="refactoring">Refactoring</h2>
<h3 id="jdt-dependency-reduction">JDT Dependency Reduction</h3>
<p>Xtext languages can be deployed in environments without JDT UI. In some use cases it was detected that this can still lead to runtime errors due to (<code>NoClassDefFoundError</code>). Dependencies in the following bundles have been resolved:</p>
<ul>
<li><code>org.eclipse.xtext.builder</code> (<a href="https://github.com/eclipse/xtext-eclipse/issues/386">issue#386</a>)</li>
<li><code>org.eclipse.xtext.xbase.ui</code> (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=509630">bug#509630</a>)</li>
</ul>
<p>We reduced usage of internal API which is subject for removal in JDT. Since older Xtext versions rely on this API, the API is kept by the JDT team for backwards compatibility of Xtext. (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=525462">bug#525462</a>)</p>
<h3 id="improved-support-for-indentation-based-languages">Improved Support for Indentation Based Languages</h3>
<p>Token placement for INDENT / DEDENT tokens have been improved. This improves content assist for indentation based languages. (<a href="https://github.com/eclipse/xtext-core/pull/366">issue#366</a>)</p>
<h3 id="new-generator-infrastructure">New Generator Infrastructure</h3>
<p>Xtext 2.9 introduced a <a href="version-2-9-0">new generator infrastructure</a>. While new projects created with Xtext and the main languages in Xtext already used this generator, there were still some languages, especially test languages, that still used the deprecated old infrastructure. All languages are now migrated to the new generator.</p>
<h2 id="an-eye-on-quality">An Eye on Quality</h2>
<p>With every release we are working hard on fixing as many bugs as possible. Besides our Bugtrackers Eclipse Bugzilla and GitHub Issues the <a href="https://www.codetrails.com/error-analytics/">Automatic Error Reporting System</a> at Eclipse (AERI) is an incredible valuable source of information for us. It uncovers real problems by real users, and has made error reporting to Eclipse a no-brainer.</p>
<p>As Xtext is a complex framework with an incredible flexibility, much can go wrong. Often these errors indicate ways of usage which we could not predict, or they show problems in custom DSLs. Sometimes they uncover also errors in code that we use. We are actively visiting the reports we get into EARI, with a focus on frequently occuring events and new ones.</p>
<p>The Xtext team is proud that this continuous effort finally pays off. For the first time ever, we had several weeks with no new problem report. And fighting against the existing issues no a clear burn-down curve (see the Incidents Timeline). From all problems reported to AERI, we have just ~12% open, and the most frequent and urgent ones are solved.</p>
<p><img src="/Xtext/images/releasenotes/2_13_aeri_problem_status.png" alt="" /><br />
<img src="/Xtext/images/releasenotes/2_13_aeri_problem_resolution.png" alt="" /><br />
<img src="/Xtext/images/releasenotes/2_13_aeri_incidents_timeline.png" alt="" /></p>
<h2 id="improved-developer-contribution-support">Improved Developer Contribution Support</h2>
<p>Setting up a developer workspace has never been so easy! We have reviewed and updated our Oomph Setup which allows you to create an Eclipse development environment for Xtext with a few clicks. Just get the <a href="https://www.eclipse.org/downloads/">Eclipse Installer</a>, go to Advanced Mode and select the Xtext subprojects you are working with. Let the Installer do the rest of the work while getting a fresh coffee.</p>
<h3 id="execution-environment">Execution Environment</h3>
<p>Minimal requirements are:</p>
<ul>
<li>Java 8</li>
<li>Eclipse Luna</li>
<li>EMF 2.10</li>
<li>Guice 3.0</li>
</ul>
<p>Xtext has been tested also on Eclipse Oxygen.1a and Eclipse Photon M2.</p>
<h2 id="some-words-on-java-9">Some words on Java 9</h2>
<p>Java 9 Support in Eclipse Oxygen 1a and Xtext 2.13 is not yet in a perfect state. To be able to run mwe workflows you need either to remove <code>org.objectweb.asm</code> from the mwe classpath (adapting manifest or build.properties) or install ASM 6.0 from the latest Eclipse Orbit repositories. The Compilation of Xtext projects with Java 9 is terrible slow due to a know <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=526209">bug</a> in JDT. So using Xtext 2.13 and Java 9 in production should be considered thrice and is not recommended. Setting the compiler level to 1.8 mitigates the performance issue slightly.</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/05/25/version-2-12-0">
<h1>Xtext 2.12.0 Release Notes<small>&nbsp;&nbsp;May 25, 2017</small></h1>
<br/>
<p>Xtext 2.12.0 brings several bug fixes and a new API for tracing generated code.</p>
<h2 id="new-tracing-api-for-generators">New Tracing API for Generators</h2>
<p>The new API in the <code>org.eclipse.xtext.generator.trace</code> package allows to generate text files along with trace files. These trace files can be used by generic UI such as the “Open Generated File” action as well as domain-specific features such as debugging. It’s very easy to add such tracing information to a code generator, e.g. with <a href="https://www.eclipse.org/xtend/documentation/203_xtend_expressions.html#templates">Xtend templates</a>:</p>
<pre><code class="language-xtend">class MyDslGenerator extends AbstractGenerator {
@TracedAccessors(MyDslFactory)
static class MyDslTraceExtensions {}
@Inject extension MyDslTraceExtensions
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
val m = resource.contents.head as Model
fsa.generateTracedFile("foo/Bar.txt", m, '''
// generated
«FOR c : m.types»
«generateClass(c)»
«ENDFOR»
''')
}
@Traced def generateClass(ClassDeclaration it) '''
class «_name» {
«FOR m : members»
«generateMember(m)»
«ENDFOR»
}
'''
@Traced def dispatch generateMember(Operation it) '''
«_name»(«FOR it : parameter»«_name» : «_type[name.name]»«ENDFOR») : «_type[name.name]»
'''
@Traced def dispatch generateMember(Property it) '''
«_name» : «_type[name.name]»
'''
}
</code></pre>
<p>Here <code>_name</code> and <code>_type</code> are <a href="https://www.eclipse.org/xtend/documentation/202_xtend_classes_members.html#extension-methods">extension methods</a> that are generated for the metamodel of the specific language. They generate text and trace it to the respective part of the DSL source. You can find the <a href="https://github.com/TypeFox/tracing_codegen">full example project on GitHub</a>.</p>
<h2 id="bug-lists">Bug Lists</h2>
<ul>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Aissue+milestone%3ARelease_2.12+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.12+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>
</ul>
</section>
<hr/>
<section id="/releasenotes/2017/02/01/version-2-11-0">
<h1>Xtext 2.11.0 Release Notes<small>&nbsp;&nbsp;Feb 1, 2017</small></h1>
<br/>
<p>Version 2.11.0 is the first release of Xtext after its big internal restructuring. The successful core of Xtext is used in many applications and projects around the world, as a result our main focus for 2.11 has been keeping the high quality and stability of the project while setting the course for a more sustainable future.</p>
<h2 id="restructuring-and-build">Restructuring and Build</h2>
<p>Xtext and Xtend used to be one big Git repository containing all sources for Eclipse, IDEA, Web integration etc. As of 2.11, we split that into multiple smaller repository, such that you can choose yourself which ones you need. These are</p>
<ul>
<li><a href="https://github.com/eclipse/xtext-core">xtext-core</a>: The core framework, <a href="https://github.com/Microsoft/vscode-languageserver-protocol">Language Server</a> support</li>
<li><a href="https://github.com/eclipse/xtext-lib">xtext-lib</a>: Libraries for <a href="/Xtext/documentation/305_xbase.html">Xbase</a> and <a href="http://www.xtend-lang.org">Xtend</a></li>
<li><a href="https://github.com/eclipse/xtext-extras">xtext-extras</a>: Additional editor-independent features, mostly Java support</li>
<li><a href="https://github.com/eclipse/xtext-eclipse">xtext-eclipse</a>: Plug-ins for <a href="http://eclipse.org">Eclipse</a></li>
<li><a href="https://github.com/eclipse/xtext-idea">xtext-idea</a>: Plug-ins for <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a></li>
<li><a href="https://github.com/eclipse/xtext-web">xtext-web</a>: Support for <a href="http://eclipse.org/orion/">Orion</a>, <a href="http://ace.c9.io">Ace</a> and <a href="https://codemirror.net">CodeMirror</a></li>
<li><a href="https://github.com/eclipse/xtext-maven">xtext-maven</a>: Support for <a href="https://maven.apache.org">Maven</a></li>
<li><a href="https://github.com/eclipse/xtext-xtend">xtext-xtend</a>: The <a href="http://www.xtend-lang.org">Xtend</a> language</li>
<li><a href="https://github.com/eclipse/xtext-umbrella">xtext-umbrella</a>: Common Eclipse features and P2 update sites</li>
</ul>
<p>In addition to that, we use Gradle now to build all non-Eclipse artifacts and Maven/Tycho for the Eclipse plug-ins. We have also set up a very sophisticated staged Jenkins build that allows to build from individual branches as well.</p>
<h2 id="language-server-protocol">Language Server Protocol</h2>
<p>With 2.11 the Xtext project supports the <a href="https://github.com/Microsoft/language-server-protocol">language server protocol</a> (LSP), which will allow users to host their languages in many different editors. So far LSP support for <a href="https://code.visualstudio.com/">VS Code</a>, the Eclipse IDE, <a href="https://www.eclipse.org/che/">Eclipse Che</a>, <a href="https://orionhub.org">Eclipse Orion</a>, and Emacs exists. Furthermore Microsoft’s Monaco editor provides support and can be integrated in any JavaScript application.</p>
<p>The LSP support in Xtext v2.11 is marked as provisional to leave open the possibility to further enhance the architecture and API. That said it is known to be used in commercial products already. Also in the long term the LSP support might replace the native <a href="/Xtext/documentation/330_web_support.html">web-editor support</a>.</p>
<p><img src="/Xtext/images/releasenotes/2_11_vscode_example.png" alt="" /></p>
<h2 id="idea-support">IDEA Support</h2>
<p>The IntelliJ IDEA integration of Xtext is currently lacking contributors. Therefore, unfortunately, the IDEA support has <strong>not</strong> been part of the 2.11 release. <a href="https://github.com/eclipse/xtext-idea/issues">Contributions are very welcome</a>!</p>
<h2 id="important-changes">Important Changes</h2>
<h3 id="execution-environment">Execution Environment</h3>
<p>All Xtext plug-ins now require JavaSE-1.8 as execution environment. The minimal supported target platform is Eclipse Luna.</p>
<h3 id="testing-projects">Testing Projects</h3>
<p>There are new projects <code>org.eclipse.xtext.testing</code> for general testing utility and <code>org.eclipse.xtext.xbase.testing</code> for testing Xbase languages. These projects contain the platform-independent code from <code>org.eclipse.xtext.junit4</code> and <code>org.eclipse.xtext.xbase.junit</code>, respectively. The classes that have been copied to the new <code>testing</code> projects are now marked as deprecated in the old <code>junit</code> projects, but those can still be used for testing Eclipse UI features.</p>
<h3 id="ide-guice-module">IDE Guice Module</h3>
<p>Xtext uses <a href="/Xtext/documentation/302_configuration.html#dependency-injection">dependency injection with Guice</a> for language-specific configuration. There are separated hierarchies of Guice modules that aim at different integration platforms: <a href="https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext/src/org/eclipse/xtext/service/DefaultRuntimeModule.java">Runtime</a> (core services used by all language integrations), <a href="https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/DefaultUiModule.java">Eclipse</a>, <a href="https://github.com/eclipse/xtext-idea/blob/master/org.eclipse.xtext.idea/src/org/eclipse/xtext/idea/DefaultIdeaModule.xtend">IDEA</a>, and <a href="https://github.com/eclipse/xtext-web/blob/master/org.eclipse.xtext.web/src/main/java/org/eclipse/xtext/web/server/DefaultWebModule.xtend">Web</a>. The 2.11 release introduces a new <a href="https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.xtend">IDE</a> module hierarchy, which is used for generic editor and IDE features. This new module is employed by the <a href="/Xtext/documentation/330_web_support.html">web-editor support</a> and the LSP support, but not by the Eclipse and IDEA integrations.</p>
<p>The new IDE module brings reusability of many language-specific services, but the price for this is some API breakage. If you are already using the web-editor support, you’ll need to make a few changes to your language configuration:</p>
<ul>
<li>Remove constructors from <code>&lt;Language Name&gt;WebModule</code>. ExecutorServices are now managed by the <a href="https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/ExecutorServiceProvider.xtend">ExecutorServiceProvider</a> and disposed by the <a href="https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext.util/src/org/eclipse/xtext/util/DisposableRegistry.xtend">DisposableRegistry</a>.</li>
<li>Move custom bindings for generic IDE services from <code>&lt;Language Name&gt;WebModule</code> to the new <code>&lt;Language Name&gt;IdeModule</code> (e.g. content assist).</li>
<li>Fix <code>&lt;Language Name&gt;WebSetup</code> and <code>&lt;Language Name&gt;Servlet</code>; if unsure how to do that, delete them, re-run the language generator workflow, and reapply any customizations you made.</li>
</ul>
<h2 id="xbase-features">Xbase Features</h2>
<h3 id="improved-xbase-compiler">Improved Xbase Compiler</h3>
<p>The Java code produced by the Xbase compiler is now <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=492072">less verbose and more readable</a>. For many situations Xbase 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="/Xtext/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="/Xtext/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="/Xtext/images/releasenotes/2_11_xbase-compare-null-quickfix.png" alt="" /></p>
<h2 id="xtext-project-wizard">Xtext Project Wizard</h2>
<h3 id="usability">Usability</h3>
<p>We have examined the user experience with the New Xtext Project wizard and improved it with the input we gained from users. It was possible to enter invalid values for <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=481380">project names</a> and <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=481380">file extensions</a>, this is now checked.</p>
<p>An usability test of the advanced configuration page revealed that especially less experienced users could had <a href="https://github.com/eclipse/xtext-eclipse/issues/119">issues with the dependencies between options</a>. From different proposals it turned out best from the user’s perspective if mandatory options are automatically selected and disable. Further an information message is presented to the user about this action. The ‘Generic IDE Support’ option gets an additional information hover.</p>
<p><img src="/Xtext/images/releasenotes/2_11_project-wizard-autoselect.png" alt="" /></p>
<p>The wizard’s text messages have been revised and <a href="https://github.com/eclipse/xtext-eclipse/pull/157">made consistent</a>.</p>
<h3 id="line-delimiter">Line Delimiter</h3>
<p>The Xtext project wizard now <a href="https://github.com/eclipse/xtext-core/issues/101">considers the workspace default line delimiter</a> and configures the generated MWE2 workflow accordingly. As a result the artifacts produced by the Xtext generator will use the same line delimiter explicitly.</p>
<h3 id="tycho-build-configuration">Tycho Build Configuration</h3>
<p>For projects that are created with Eclipse plug-in and Maven as build system, the generated target definition is upgraded to <a href="https://github.com/eclipse/xtext-core/issues/79">use the Eclipse Neon repository</a>. Eclipse Tycho is <a href="https://github.com/eclipse/xtext-core/issues/76">configured with version 0.25.0</a> now.</p>
<h2 id="example-projects">Example Projects</h2>
<p>The provided example projects have been revised and use the new generator workflow, new project structure and new testing modules.</p>
<h2 id="deprecated-components">Deprecated Components</h2>
<h3 id="old-xtext-generator">Old Xtext Generator</h3>
<p>With Xtext 2.9 a <a href="/Xtext/releasenotes.html#/releasenotes/2015/11/16/version-2-9-0">new generator infrastructure was introduced</a>. In favor of this new generator <a href="https://github.com/eclipse/xtext-core/issues/58">the old generator has been deprecated</a>. Bugfixes will be done primarily for the new generator and most of them will not be backported, thus it is highly recommended to migrate your languages’ <code>.mwe2</code> workflows to use the new <a href="https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/XtextGenerator.xtend"><code>org.eclipse.xtext.xtext.XtextGenerator</code></a> component.</p>
<h3 id="running-the-language-generator-from-maven">Running the Language Generator from Maven</h3>
<p>The Maven POM module <a href="http://repo1.maven.org/maven2/org/eclipse/xtext/org.eclipse.xtext.xtext/">org.eclipse.xtext.xtext</a>, which has been deprecated since 2015, is no longer published. If you use the old generator component, you should replace the <code>org.eclipse.xtext.xtext</code> dependency according to the <a href="http://repo1.maven.org/maven2/org/eclipse/xtext/org.eclipse.xtext.xtext/2.10.0/org.eclipse.xtext.xtext-2.10.0.pom">dependencies of that module</a>. The new generator component requires much fewer dependencies; a suitable configuration for it can be obtained by creating a new Maven project with the Xtext project wizard.</p>
<h2 id="fixed-bugs">Fixed Bugs</h2>
<h3 id="closed-memory-leaks">Closed Memory Leaks</h3>
<p>The memory leak affected editors and <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=493784">downgraded performance while editing</a> resources for which JVM types are inferred (including Xtend).</p>
<p>A second leak affected the <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=479328">Syntax Graph View</a> and slowed down the IDE.</p>
<h3 id="performance">Performance</h3>
<p>The Serializer was <a href="https://github.com/eclipse/xtext-core/issues/17">performing poor</a> for certain grammars. This has been fixed.</p>
<h3 id="bug-lists">Bug Lists</h3>
<p>In addition to the restructuring and the LSP support many bugs have been fixed:</p>
<ul>
<li>
<p><a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;chfield=resolution&amp;chfieldfrom=2016-06-22&amp;chfieldto=2017-01-24&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.11&amp;list_id=15601548&amp;product=TMF&amp;product=Xtend&amp;query_based_on=Xtext%202.11&amp;query_format=advanced&amp;resolution=FIXED">Fixed Eclipse Bugzilla tickets</a></p>
</li>
<li>
<p><a href="https://github.com/search?utf8=%E2%9C%93&amp;q=is%3Aissue+milestone%3Arelease_v2.11+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_v2.11+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>
</ul>
</section>
<hr/>
<section id="/releasenotes/2016/05/25/version-2-10-0">
<h1>Xtext 2.10.0 Release Notes<small>&nbsp;&nbsp;May 25, 2016</small></h1>
<br/>
<p>This is a bugfix release. <a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;j1=OR&amp;list_id=15981214&amp;query_format=advanced&amp;status_whiteboard=v2.10&amp;status_whiteboard_type=allwordssubstr">Here</a> is the list of the fixed bugs.</p>
</section>
<hr/>
<section id="/releasenotes/2015/11/16/version-2-9-0">
<h1>Xtext 2.9.0 Release Notes<small>&nbsp;&nbsp;Nov 16, 2015</small></h1>
<br/>
<p>Version 2.9.0 is the first release of Xtext to ship with support for IntelliJ and the Web. Additionally, the “New Project Wizard” does now offer to create Maven or Gradle build support for your new project. Advanced uses may appreciate two new features in the Xtext grammar language.</p>
<p>The release ships with over 240 bugfixes and enhancements. The full bugzilla log can be found <a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;j1=OR&amp;list_id=11172029&amp;query_format=advanced&amp;status_whiteboard=v2.9&amp;status_whiteboard_type=allwordssubstr">here</a>.</p>
<p>The following features have been added in particular.</p>
<h2 id="develop-your-xtext-language-in-intellij-idea">Develop your Xtext Language in IntelliJ IDEA</h2>
<p>Xtext not only lets you develop an IDEA plug-in for your language but you can also do the language development itself entirely within Jetbrains popular IDE. <br />
Check out <a href="http://blogs.itemis.com/xtext/get-started-with-xtext-and-intellij-idea-in-5-minutes">this tutorial</a> to learn how this works.</p>
<h2 id="run-your-xtext-smart-editor-in-the-web">Run your Xtext Smart Editor in the Web</h2>
<p>With Xtext you can now also have rich text editors for you language in the Web.<br />
With Version 2.9.0 we already support three different javascript editor frameworks. For more details read the corresponding <a href="https://www.eclipse.org/Xtext/documentation/310_web_integration.html">section in the documentation</a>.</p>
<h2 id="new-xtext-project-wizard">New Xtext Project Wizard</h2>
<p>A new wizard to produce a readily configured Xtext project has been developed. It is used in both IntelliJ and Eclipse and allows the user to</p>
<ul>
<li>decide which target editors your want (Eclipse, Web, IntelliJ)</li>
<li>what build system you prefer (Maven or Gradle)</li>
<li>tell the project layout. I.e. whether you want Maven-style src/main/java or the standard src/ folder scheme.</li>
<li>and whether you want testing support</li>
</ul>
<h2 id="new-xtext-code-generator">New Xtext Code Generator</h2>
<p>We have entirely rewritten the code generator that produces the various artifacts from grammars. It is now simpler to configure and at the same time supports the various new options, the new Xtext wizard provides.</p>
<h2 id="enhanced-gradle-and-maven-support">Enhanced Gradle and Maven Support</h2>
<p>The Maven and Gradle plugins have been overhauled and improved. Additionally we added full support to run, build and test IntelliJ IDEA plugins from Gradle.</p>
<h2 id="incremental-standalonebuilder">Incremental Standalonebuilder</h2>
<p>The Eclipse builder always worked incrementally. We have now written one that is Eclipse-independent and is used from within IntelliJ as well as a Gradle Deamon.</p>
<h2 id="grammar-language-enhancements">Grammar Language Enhancements</h2>
<p>New features in the grammar language allow to reduce duplicate grammar information. Fragments are a way to inline similar productions in different rules, while parameters can be used to call turn off parts of a production. More details can be found <a href="http://zarnekow.blogspot.de/2015/10/the-xtext-grammar-learned-new-tricks.html">here</a>.</p>
</section>
<hr/>
<section id="/releasenotes/2015/03/11/version-2-8-0">
<h1>Xtext 2.8.0 Release Notes<small>&nbsp;&nbsp;Mar 11, 2015</small></h1>
<br/>
<p>Version 2.8.0 comes with over 260 bugfixes and enhancements, the runtime performance as well as the tool performance has been improved significantly. The full bugzilla log can be found <a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;j1=OR&amp;list_id=11172029&amp;query_format=advanced&amp;status_whiteboard=v2.8&amp;status_whiteboard_type=allwordssubstr">here</a>.</p>
<p>The following features have been added in particular.</p>
<h2 id="whitespace-aware-languages">Whitespace-Aware Languages</h2>
<p>Xtext 2.8 supports languages in which whitespace is used to specify the structure, e.g. using indentation to delimit code blocks as in <a href="https://www.python.org">Python</a>. This is done through <em>synthetic tokens</em> defined in the grammar:</p>
<pre><code class="language-xtext">terminal BEGIN: 'synthetic:BEGIN';
terminal END: 'synthetic:END';
</code></pre>
<p>These tokens can be used like other terminals in grammar rules:</p>
<pre><code class="language-xtext">WhitespaceAwareBlock:
BEGIN
...
END;
</code></pre>
<p>The new example language <em>Home Automation</em> available in the Eclipse examples (<em>File → New → Example → Xtext Examples</em>) demonstrates this concept. It allows code like the following:</p>
<pre><code class="language-ruleengine">Rule 'Report error' when Heater.error then
var String report
do
Thread.sleep(500)
report = HeaterDiagnostic.readError
while (report == null)
println(report)
</code></pre>
<p>More details are found in the <a href="/Xtext/documentation/307_special_languages.html#whitespace-aware-languages">documentation</a>.</p>
<h2 id="enhancements-of-the-grammar-editor">Enhancements of the Grammar Editor</h2>
<h4 id="configurable-severities">Configurable Severities</h4>
<p>You can configure the severity (<em>ignore / warning / error</em>) of certain problems that are detected in a grammar file. Open <em>Xtext → Errors/Warnings</em> in the workspace preferences for global settings or in the project properties for project-specific settings.</p>
<p><img src="/Xtext/images/releasenotes/2_8_xtext-validation-preferences.png" alt="" /></p>
<h4 id="improved-content-assist">Improved Content Assist</h4>
<p>When you hit <em>Ctrl+Space</em> after the <code>with</code> keyword in a grammar definition, you get a list of available grammars which the currently edited grammar can inherit from.</p>
<p><img src="/Xtext/images/releasenotes/2_8_xtext-grammar-inheritance.png" alt="" /></p>
<h2 id="new-options-for-language-code-generation">New Options for Language Code Generation</h2>
<p>The <em>Generator</em> component supports two new options.</p>
<h4 id="class-annotations">Class Annotations</h4>
<p>You can specify annotations to be added to each generated Java class. With the following workflow configuration, the annotation <code>@Generated</code> is added to each class:</p>
<pre><code class="language-mwe2">Workflow {
component = Generator {
classAnnotation = GeneratedClassAnnotation {}
...
}
}
</code></pre>
<p>You can also specify your own class annotations by implementing the interface <em>IClassAnnotation</em> and adding that implementation to the configuration.</p>
<h4 id="file-header">File Header</h4>
<p>Xtext generates Java files with the following file header comment:</p>
<pre><code class="language-java">/*
* generated by Xtext
*/
</code></pre>
<p>With Xtext 2.8, this can be configured in the workflow configuration with the <em>fileHeader</em> property of the <em>Generator</em> component.</p>
<pre><code class="language-mwe2">var myFileHeader = "/*----------------------------
* My fancy file header
* (c) \${year} Dr. Evil, inc.
*----------------------------*/"
Workflow {
component = Generator {
fileHeader = myFileHeader
...
}
}
</code></pre>
<h2 id="target-java-version-xbase">Target Java Version (Xbase)</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="/Xtext/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 default version level of the Xbase compiler from the beginning, so the generated code is the same as with earlier Xbase versions if you choose this target version.</p>
<h3 id="java-6">Java 6</h3>
<p>When the Xbase 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>Xbase 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 Xbase 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 Xbase 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="/Xtext/documentation/305_xbase.html#xbase-expressions-lambda">Xbase 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, Xbase 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 Xbase lambdas are fully compatible with Java 8 lambdas.</p>
<h2 id="more-compiler-options-xbase">More Compiler Options (Xbase)</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="unique-class-name-validation-xbase">Unique Class Name Validation (Xbase)</h2>
<p>Unique Java type name checks are now activated for all Xbase languages on a per project level.</p>
<h2 id="open-generated-file-xbase">Open Generated File (Xbase)</h2>
<p>You can open the Java file that was generated from an Xbase DSL instance by right-clicking the DSL editor and selecting <em>Open Generated File</em>.</p>
<p><img src="/Xtext/images/releasenotes/2_8_xbase-open-generated.png" alt="" /></p>
<h2 id="interruption-of-incremental-build">Interruption of Incremental Build</h2>
<p>Instead of blocking the user with a modal dialog, running incremental builds will be now get interrupted when a user saves a file. Less blocking, yay!</p>
<h2 id="new-formatter-provisional">New Formatter (Provisional)</h2>
<p>Xtext 2.8 comes with a new formatting API in addition to the previous API. The new API allows to implement formatting not only based on the static structure of the grammar but also on the actual model structure. This overcomes many limitations of the previous API, which was present since the first version of Xtext. Things that are now possible include:</p>
<ul>
<li>Add line breaks to long lists of items but keep short lists in one line.</li>
<li>Arrange elements in a tabular layout.</li>
<li>Apply formatting to values of data type rules or comments.</li>
<li>Consider the existing whitespace information and implement an adaptive layout.</li>
<li>Provide user configurable preferences for the formatting settings.</li>
</ul>
<p>More details are found in the <a href="/Xtext/documentation/303_runtime_concepts.html#formatting">documentation</a>.</p>
<h2 id="storable-resources-provisional">Storable Resources (Provisional)</h2>
<p>Full resolution of Xtext resources can be very expensive. During compilation, complex languages like Xtend go through different phases that involve a lot of computation. With 2.8 we have introduced the possibility to store computed resource state and load it on demand if no changes are expected. We have activated this for Xtend and it reduces the amount of work for incremental changes significantly as dependent resources get loaded from storage much quicker. The API is still provisional for now.</p>
<h2 id="xtend-features">Xtend Features</h2>
<h4 id="convert-java-to-xtend">Convert Java to Xtend</h4>
<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>
<h4 id="more-java-8-support">More Java 8 Support</h4>
<p>The new version of Xtend of course includes all enhancements of Xbase described above, including support for Java 8. In addition, 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="important-changes">Important Changes</h2>
<h4 id="execution-environment">Execution Environment</h4>
<p>All Xtext plug-ins now require JavaSE-1.6 as execution environment. Furthermore, the Java code generated by Xtext uses <code>@Override</code> annotations for methods overriding or implementing other declared methods, so the plug-ins into which this code is generated must use at least JavaSE-1.6 as execution environment. If your plug-ins are set to J2SE-1.5 and you run the Xtext 2.8 code generator, you will probably get compiler errors like <em>The method ‘m’ of type ‘T’ must override a superclass method</em>; eliminate them by switching to a higher Java version.</p>
<h4 id="regenerate-your-xbase-languages">Regenerate Your Xbase Languages</h4>
<p>Xbase languages need to be regenerated once in order to work with version 2.8.</p>
<h4 id="expiring-junit-3-support">Expiring JUnit 3 Support</h4>
<p>We are planing to remove support for JUnit version 3. The code form the plug-ins <code>org.eclipse.xtext.junit</code> and <code>org.eclipse.xtext.ui.junit</code> will be removed from our repository in the next version. Please migrate to the respective counterparts in <code>org.eclipse.xtext.junit4</code>.</p>
</section>
<hr/>
<section id="/releasenotes/2014/09/02/version-2-7-0">
<h1>Xtext 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 :
</p>
<section id="inferrer_api" style="padding-top: 68px; margin-top: -68px;">
<h2>Published Inferrer API of Xbase</h2>
<p>
The JVM model inferrer API, which is the heart of Xbase, has been finalized and is now public. We took the opportunity to simplify it in some places. Have a look at the <a href="https://github.com/xtext-dev/seven-languages-xtext/tree/xtext_2.7">updated seven languages example</a> for idiomatic usage of the API.
</p>
</section>
<section id="xtext_performance_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>Performance Improvements</h2>
<p>
Xtext is now able to cancel many jobs (like refreshing the outline view) when the user starts typing, greatly improving responsiveness. Also, many UI actions can now be cancelled by hitting the "Stop" button.
Resource clustering is now supported in the builder participant and standalone builder, reducing the memory footprint for large projects. There is a new parallel builder participant that can be used for even more performance gains.
</p>
</section>
<section id="xtext_xcore_integration_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>
Better Integration with Xcore
</h2>
<p>
The "New Xtext Project" wizard now supports Xcore models and adding them to an existing mwe2 workflow is as simple as specifying them as a <code>loadedResource</code>. Xcore itself has undergone some serious performance improvements, making it suitable even for large models.
</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_7_xtext-xcore-wizard.png"/>
</section>
<section id="xtext_debugging_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>Debugging</h2>
<p>
Breakpoints can now be toggled, enabled/disabled and inspected via the ruler context menu. Partial support for conditional breakpoints was added. Content assist in the condition editor will be added in version 2.8.
</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_7_xtext-breakpoint-toggle.png"/>
</section>
<section id="xtext_find_references_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>
Find References improved
</h2>
<p>
The find references API is now available in the runtime plugin and has undergone some performance improvements.
</p>
</section>
<section id="xtext_cross_platform_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>
Cross Plattform Improvements
</h2>
<p>
All Xtext generator fragments now accept an explicit line delimiter, so heterogeneous teams get the same results when generating the language infrastructure.
</p>
</section>
<section id="xtend_2_7" style="padding-top: 68px; margin-top: -68px;">
<h1>
Xtend 2.7.0
</h1>
</section>
<section id="xtend_language_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>
Language
</h2>
<p>
It is now allowed to leave out parameter declarations for all lambda expressions using a positional syntax.
<pre class="prettyprint lang-xtend linenums">
#[1, 2, 3].reduce[$0 + $1]
</pre>
Enum constants in annotations can be referenced without their type name.
<pre class="prettyprint lang-xtend linenums">
@Retention(RUNTIME)
</pre>
Type inference for parameterized inner classes was improved and supports types like
<pre class="prettyprint lang-xtend linenums">
Option&LT;T&GT;.Some
</pre>
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="/Xtext/images/releasenotes/2_7_xtend-dead-code-analysis.png"/>
<img>
</section>
<section id="xtend_library_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>
Library
</h2>
<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>
<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>
<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 id="xtend_ide_features_2_7" style="padding-top: 68px; margin-top: -68px;">
<h2>IDE Features</h2>
</section>
<section id="xtend_debugging_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Debugging
</h3>
<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="/Xtext/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="/Xtext/images/releasenotes/2_7_xtext-breakpoint-toggle.png"/>
</section>
<section id="xtend_content_assist_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Content Assist
</h3>
<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 id="xtend_performance_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Performance Improvements
</h3>
<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 id="xtend_outline_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Outline with Java-Mode
</h3>
<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="/Xtext/images/releasenotes/2_7_xtend-outline-normal.png"/>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_7_xtend-outline-jvm.png"/>
</section>
<section id="xtend_organize_imports_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Organize imports on packages
</h3>
<p>
You can now use "Organize Xtend Imports" on whole packages via the "Source" context menu.
</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_7_xtend-organize-imports.png"/>
</section>
<section id="xtend_template_proposals_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Template proposals support import
</h3>
<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="/Xtext/images/releasenotes/2_7_xtend-templates-import.png"/>
</section>
<section id="xtend_open_return_type_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Open return type
</h3>
<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 id="xtend_show_java_errors_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>
Show errors from derived Java files
</h3>
<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 id="xtend_maved_2_7" style="padding-top: 68px; margin-top: -68px;">
<h3>Maven and Java 8</h3>
<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>Xtext 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:
</p>
<section id="todo_tags" style="padding-top: 68px; margin-top: -68px;">
<h2>Task Tags</h2>
<p>TODO, FIXME, and XXX markers in comments are now recognized by the IDE as task markers.
It will be enabled for all Xtext languages, without any further ado (not even a rebuild is required).
To get an corresponding preference page for configuraing the kind of Task markers, a special generator fragment is available.</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_6_0_task_markers.png"/>
</section>
<section id="gradle_plugin" style="padding-top: 68px; margin-top: -68px;">
<h2>Gradle Plug-in</h2>
<p>A gradle plug-in for easy integration of the Xtext-based languages in any Gradle-based Java projects is now available.<br/>
The gradle plug-in is hosted <a href="https://github.com/oehme/xtext-gradle-plugin">at github</a>. </p>
<p>All ou need to do is to add the plugin to your build classpath:</p>
<pre class="prettyprint lang-xtend linenums">
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.xtext:xtext-gradle-plugin:0.0.2'
}
}
</pre>
<p>Add your languages to the xtextTooling configuration</p>
<pre class="prettyprint lang-xtend linenums">
dependencies {
xtextTooling 'org.example:org.example.hero.core:3.3.3'
xtextTooling 'org.example:org.example.villain.core:6.6.6'
}
</pre>
<p>Add code that your models compile against to the xtext configuration. If you use the Java plugin, this configuration will automatically contain everything from compile and testCompile. So in many cases this can be omitted.</p>
<pre class="prettyprint lang-xtend linenums">
dependencies {
xtext 'com.google.guava:guava:15.0'
}
</pre>
<p>Configure your languages</p>
<pre class="prettyprint lang-xtend linenums">
xtext {
version = '2.5.3' // the current default, can be omitted
encoding = 'UTF-8' //the default, can be omitted
/* Java sourceDirs are added automatically,
* so you only need this element if you have
* additional source directories to add
*/
sources {
srcDir 'src/main/heroes'
srcDir 'src/main/villains'
}
languages{
heroes {
setup = 'org.example.hero.core.HeroStandaloneSetup'
consumesJava = true
outputs {
DEFAULT_OUTPUT.dir = 'build/heroes'
SIDEKICKS.dir = 'build/sidekicks'
}
}
villains {
setup = 'org.example.villain.core.VillainStandaloneSetup'
//equivalent to DEFAULT_OUTPUT.dir
output.dir = 'build/villains'
}
}
}
</pre>
<section id="first_token_syntactic_predicates" style="padding-top: 68px; margin-top: -68px;">
<h2>First-TokenSet Syntactic Predicates</h2>
<p>Syntactic predicates are used to solve ambiguities in grammars. Sometimes the predicate needs to be set on a more complex rule call, which might involve consuming a great number of tokens.
With traditional syntactic predicates using the <code>=&gt;</code> operator, the parser would need to match all of those tokens in order to make te decision. The new operator <code>-&gt;</code>
tells the parser to only look at the first token and make the decision based on that, which is sufficient in most cases. As a result the parser is faster and does better error recovery.</p>
</section><section id="synchronized_expression" style="padding-top: 68px; margin-top: -68px;">
<h2>Xbase - Synchronized Expression</h2>
<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="switch_fall_through" style="padding-top: 68px; margin-top: -68px;">
<h2>Xbase - Switch Fall Through</h2>
<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;">
<h2>Xbase - Compound Assignments</h2>
<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;">
<h2>Xbase - Postfix Operators</h2>
<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;">
<h2>Xbase - Traditional For-Loop</h2>
<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;">
<h2>Xbase - Multivalued Annotations Sugar</h2>
<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 id="xbase_open_implementation" style="padding-top: 68px; margin-top: -68px;">
<h2>Xbase - Open Implementation</h2>
<p>In addition to go to declaration, you can now navigate to existing implementations of a method. It works just like in JDT</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_6_0_open_implementation.png"/>
</section><section id="xbase_debug_hover" style="padding-top: 68px; margin-top: -68px;">
<h2>Xbase - Debug Hover Shows Inspect Dialog</h2>
<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="/Xtext/images/releasenotes/2_6_0_debug_hover_variable.png"/>
</section><section id="xbase_hover_annotations" style="padding-top: 68px; margin-top: -68px;">
<h2>Xbase - Hover Shows Annotations</h2>
<p>The declaration hover now includes the annotations.</p>
<img class="image_between_p" src="/Xtext/images/releasenotes/2_6_0_annotations_in_hover.png"/>
</section>
</section><section id="xbase_android_lib" style="padding-top: 68px; margin-top: -68px;">
<h2>Treeshaken Xbase Lib for Android</h2>
<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>Xtext 2.5.0 Release Notes<small>&nbsp;&nbsp;Dec 11, 2013</small></h1>
<br/>
<p>
Xtext 2.5.0 includes
<a href="https://bugs.eclipse.org/bugs/buglist.cgi?f1=OP&list_id=7722745&f0=OP&status_whiteboard_type=allwordssubstr&f4=CP&query_format=advanced&j1=OR&f3=CP&status_whiteboard=v2.5&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED">more than 100 bug fixes and enhancements</a>.
Some of the more important enhancements are :
</p>
<section id="annotations_2_5" style="padding-top: 68px; margin-top: -68px;">
<h2>Better Maven Support</h2>
<p>
Xtext 2.5.0 comes with much improved support for integrating Xtext languages and the corresponding code generators in
continuous integration builds. All the needed jars are available on Maven central now and we have added a dedicated Maven compiler plug-in that
simulates the incremental build in a headless Java Maven build (no Tycho needed!). Please read the <a href="/Xtext/documentation/302_configuration.html#continuous-integration">new section in the documentation</a> for more
details on the new Maven support.
</p>
<pre class="prettyprint xml linenums">
&lt;plugin&gt;
&lt;groupId&gt;org.eclipse.xtext&lt;/groupId&gt;
&lt;artifactId&gt;xtext-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;2.5.0&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;goals&gt;
&lt;goal&gt;generate&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;configuration&gt;
&lt;languages&gt;
&lt;language&gt;
&lt;setup&gt;my.mavenized.HeroLanguageStandaloneSetup&lt;/setup&gt;
&lt;outputConfigurations&gt;
&lt;outputConfiguration&gt;
&lt;outputDirectory&gt;src/main/generated-sources/xtend/&lt;/outputDirectory&gt;
&lt;/outputConfiguration&gt;
&lt;/outputConfigurations&gt;
&lt;/language&gt;
&lt;/languages&gt;
&lt;/configuration&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;my.mavenized.herolanguage&lt;/groupId&gt;
&lt;artifactId&gt;my.mavenized.herolanguage&lt;/artifactId&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/plugin&gt;
</pre>
</section>
<section id="compilerchecks" style="padding-top: 68px; margin-top: -68px;">
<h2>Enhancements for Xbase</h2>
<p>
The Xbase language and compiler has been improved in many ways.
</p>
<h3>Full support for Annotations</h3>
<p>
Xbase now supports all annotation values and constant expressions in annotations.
</p>
<pre class="prettyprint lang-xtend linenums">
class MyEntity {
@Columns(#[@Column('id'), @Column(value = 'timestamp', length = 2 * 3 * 7)])
CompositeKey key
}
</pre>
<h3 id="ambiguous_methods">Method overload validation</h3>
<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>
<p>
Here's an example how it is used within Xtend.
</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</h3>
<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>
<h3 id="improved_auto_casts">Auto casts</h3>
<p>
Xbase 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">
if (c instanceof String) {
c.substring(42)
}
</pre>
<h3 id="switch_enum">Switch over enums</h3>
<p>
One of the few places where Xbase'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">
switch p {
case CLASS: 1
case RUNTIME: 2
case SOURCE: 3
}
</pre>
<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>
</div>
</div>
</div>
<footer class="site-footer">
<div id="extra">
<div class="inner">
<div class="container">
<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/xtext"><img src="/Xtext/images/Twitter-bird-darkgray.png" class="img-responsive" style="margin-right: 5px;height: 1em;" alt="Twitter icon">@xtext on Twitter</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<a href="#" class="scrollup fadeOutRight animated" style="display: none;">ScrollUp</a>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/Xtext/js/jquery-1.11.3.min.js"></script>
<script src="/Xtext/js/bootstrap.min.js"></script>
<script src="/Xtext/js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="/Xtext/js/jquery.prettyPhoto.js" type="text/javascript"></script>
<script src="/Xtext/js/prettify.js" type="text/javascript"></script>
<script src="/Xtext/js/lang-xtend.js" type="text/javascript"></script>
<script src="/Xtext/js/lang-common.js" type="text/javascript"></script>
<script src="/Xtext/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-3' ]);
_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-->
<script src="/Xtext/js/coverflow.min.js" type="text/javascript"></script>
<script>
$(function() {
$('#coverflow').coverflow({
active : 1,
visibleAside: 2,
overlap : 0.5,
scale : 0.9,
angle : 20,
trigger : {
"itemfocus" : true,
"swipe" : true,
"mousewheel" : false
}
});
$('#coverflow :hidden').toggle();
$(window).resize(function() {
$('#coverflow').coverflow();
});
});
</script>
</footer>
</body>
</html>