This page is a work in progress and will only be complete once Groovy 1.7 is released. However, the content of this page will be used for the various intermediary releases till the final one.
Anonymous Inner Classes
Groovy's support of annotations is identical to Java 5 annotations, but we felt that in some cases it would be interesting to be able to add annotations in other places than the usual places (types, fields, methods, parameters, etc.). For instance, in Java, it is impossible to add annotations on imports, packages or variable declarations. Groovy does go beyond and adds support for annotation on imports, packages and variable declarations. We'll take a look at the usage of those extended annotations on Grape.
The Grape dependency system lets you request dependencies in your scripts, without having to deal with downloading, packaging, or specifying the classpath yourself. To use Grape, we had to use the @Grab annotation to "grab" a dependency from a repository (Maven's central repository, for example). The problem was that annotation had to be attached to some allowed elements, ie. the places where annotations can be put in Java. Now, we can put annotations on imports:
Another example with @Grab on variable declarations:
Also please note on this one an improvement in the @Grab annotation: we provide a shorter version taking just a String as value parameter representing the dependency, in addition to the more verbose example in the previous example. You simply append the group, module, version and classifier together, joined by colons.
With Groovy 1.6, we introduced AST Transformations,
Other minor enhancements
Some of the dependencies of Groovy have been upgraded to newer versions.
For instance, Groovy now uses the latest ASM version, which is "invokedynamic"-ready. So as we progress towards the inclusion of JSR-292 / invokedynamic, we'll be ready and be using the latest version of ASM. We also use the latest versions of Ivy which is used by the Grape dependency module.
Rewrite of the GroovyScriptEngine
The GroovyScriptEngine (which is also used by Groovlets) has been rewritten to solve various dependency issues it was suffering from, and the outcome of this is that it should also now be much faster overal.
The new logic uses additional phase operations to track dependencies. As a result the error-prone class loader technique to track them is gone now. These operations ensure that every script file will be tracked, its dependencies recorded during compilation and all transitive dependencies will be calculated. And only scripts will be recorded as dependency, no classes. The new GroovyScriptEngine also uses only one compilation "process" for script compilation which solves the problem of circular or mutual dependencies, that caused stack overflows in the past. As a result the new engine can reliably handle dependencies and should be much faster.
Groovy console preferences
A small annoyance, especially for developers using big LCD screens: the Groovy Console didn't remember preferences of position of the separator between the coding area and output view, or the font size being used. This is now fixed, as the console remembers such settings. You won't need anymore to adjust the console to your liking each time you run it, it should now have some more brain cells to remember your preferences.
SQL batch updates and transactions
The Groovy Sql class now features batch updates, thanks to its new withBatch() method, taking a closure and a statement instance:
Similarly, there's a withTransaction() method added to Sql, which works also with datasets: