Eclipse Indigo Highlights: Five Good Reasons To Check Out Xtext 2.0

DZone 's Guide to

Eclipse Indigo Highlights: Five Good Reasons To Check Out Xtext 2.0

· Java Zone ·
Free Resource

Modelling is a huge part of the Eclipse eco-system, and the Indigo release train brings Xtext 2.0, the new version of the award winning framework for developing domain specific languages. Besides hundreds of bug fixes and significant performance improvements, Xtext 2.0 introduces a refactoring framework and support for rich hover information. A new expression language can be embedded in any DSL and allows users to write computational logic right within their own language. The statically typed template language Xtend eases the development and maintenance of code generators, which are now tightly integrated with Eclipse.

"Xtext 2.0 comes with huge performance improvements and lots of shiny new IDE features such as refactorings and rich hovers for all domain-specific languages (DSL). The most important addition is the statically-typed base language which can be reused within any DSL, which unveils a whole new world of possibilities."

Xbase: A Reusable Expression Language 

Xbase is a partial programming language implemented in Xtext and can be embedded and extended within other languages written in Xtext. Expressions are at the heart of every programming language, but can be difficult to get right. Xbase helps you to allow more complex programming within your DSL, using an expression language that is closely related to Java. 

You can read more about how Xbase works at Sven Efftinge's blog, or just take it for a spin in the new Indigo release.

Xtend: A Code Generation Language

Xtend is a statically-typed programming language which tightly integrates with, and runs on, the Java VM.  It improves on the following concepts:

  • Advanced Type Inference - You rarely need to write down type signatures
  • Full support for Java Generics - Including all conformance and conversion rules
  • Closures - concise syntax for anonymous function literals
  • Injected extension methods - Enhance closed types with new functionality injected via JSR-330
  • Multiple dispatch aka polymorphic method invocation
  • Operator overloading - make your libraries even more expressive
  • Powerful switch expression - type based switching with implicit casts
  • No statements - Everything is an expression
  • Template syntax with intelligent whitespace handling
  • Translates to Java not bytecode - understand what's going on and use your code for platforms such as Android or GWT



Refactoring Framework

All Xtext based languages now get support for rename refactorings for free, simply by adding the RefactorElementNameFragment. See Jan Köhnlein's blog post about this for more details.

Xtext Refactoring from Xtext Team on Vimeo.



Support For Rich Hovers

Rich Hovers are now shown on any reference or declaration.

You'll also get quick fix hovers for Xtext grammars.


Performance Improvements

There are some huge improvements in Xtext 2.0. Check out the difference in build time: 

Not to mention the memory usage improvements: 


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}