The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Groovy 1.7 Released

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Groovy 1.7 Released Posted: Dec 22, 2009 8:35 AM
Reply to this message Reply

Following two beta releases and the same number of release candidates, Groovy 1.7 reached its final release this week.

Over the last several years, a veritable ecosystem has built up around the Groovy language, such as the Grails framework, the Griffon UI framework, several build tools, as well as specialized libraries, such as the parallel computing library Gpars. Almost all of Groovy 1.7's new features came about because of growing practical experience with the language and its various frameworks.

Anonymous inner classes and nested classes are one such feature in 1.7:

Although oftentimes closures and maps coercion suffice, there are still areas where the lack of Anonymous Inner Classes (AIC) and Nested Classes (NC) can be problematic. That's why we decided to eventually implement AIC and NC in Groovy 1.7...

class A {
    static class B {}
new A.B()

Similary, Groovy 1.7 supports an extended use of annotations:

[In] some cases it would be interesting to be able to add annotations in other ... than the usual places (types, fields, methods, parameters, etc.). For instance, in Java, it is impossible to add annotations on imports or packages. Groovy does go beyond and adds support for annotation on imports, packages and variable declarations.

Power asserts is a new, developer-friendly feature in the latest release:

With Power Asserts, initially developed in the Spock Framework, the output of the assert is now much nicer and provides a visual representation of the value of each sub-expressions of the expression being asserted.

Another set of new Groovy 1.7 features that developers will find useful makes it easier to work with the AST:

With Groovy 1.6, we introduced AST Transformations, for letting developers do compile-time metaprogramming, by modifying the Abstract Syntax Tree before it is transformed into bytecode. In Groovy 1.6, several such transformations were added, especially "local" transformations triggered by annotations (such as @Delegate, @Singleton, @Bindable and friends). However powerful this feature is, writing AST transformation has always been a bit tedious. Groovy 1.7 features two new features which should help simplify the work of AST transformation writers: an AST viewer and an AST builder...

[With the AST Viewer] you can visualize the AST of a script you're working on in the console: for instance, writing the code you'd like to create in your AST transformation. The AST viewer greatly help with figuring out how Groovy builds its AST when compiling your Groovy code...

The introduction of the AST builder simplifies the authoring of AST transformations, by giving you three different approaches for working on the AST:

  • building from string
  • building from code
  • building from specification

Other new features include enhancements to the SQL-related Groovy classes, a rewrite of the GroovyScriptEngine, and an improved GroovyConsole.

What do you think of the latest Groovy release?

Topic: Reified Lambda Functions Previous Topic   Next Topic Topic: Google Releases GWT 2.0

Sponsored Links


Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use