Blog

Blog

The Groovy development team is pleased to announce the release of the first beta of Groovy 2.2, along with a bug fix release of Groovy 2.1.6.

Both Groovy 2.1.6 and 2.2.0-beta-1 contain fixes for the recently discovered JavaDoc vulnerability, that also affected GroovyDoc.

Let me highlight a few interesting points in this 2.2 beta.

Implicit closure coercion

Java 8 will feature lambdas, which are similar to Groovy’s closures. One particular aspect which is interesting with lambdas is how they are converted transparently by Java to interface types that contain one single abstract method. With Groovy closures, except for a few cases, we have to explicitly use the as operator to do the coercion. In Groovy 2.2, we are allowing the same transparent closure coercion to happen, but without the explicit as type coercion, and furthermore, we make it possible to work as well with abstract classes as well.

 

Notice how the closure is coerced into a Predicate instance. Without that new capabilities, we would have had to write the following instead:

That way, Groovy closure coercion to SAM types is as concise as Java 8 lambda closure convertion.

@Memoized AST transformation for methods

Similarly to our Closure memoization capability, you can now annotate your methods with the new @Memoized annotation. It will use the same underlying cache solution used for closures, and will cache the result of previous executions of the annotated method with the same entry parameters.

 

 

New DelegatingScript base class for scripts

With the CompilerConfiguration class that you pass to GroovyShell (as well as GroovyClassLoader and others), you can define a base script class for the scripts that will be compiled with that shell. It’s handy to share common methods to all scripts.

For DSL purposes, it’s interesting to actually delegate the method calls and unbound variable assignments to a different object than the script itself, thanks to the new DelegatingScript.

To make it more concrete, let’s have a look at the following configuration script:

 

 

@DelegatesTo with generics type tokens

The @DelegatesTo annotation, introduced in Groovy 2.1 that helps the type checker, IDEs, tools, to provide better support for DSLs using closure delegation strategies, works with generics token types as well. You can tell Groovy that the delegatee is of the type of the generics component:

 

Note the genericTypeIndex attribute of @DelegatesTo that points at the index of the generic component. Unfortunately, as the generic placeholders are not kept at the bytecode level, it’s impossible to just reference T, and we had to use an index to point at the right type.

Precompiled type checking extensions

The static type checking extensions introduced in Groovy 2.1 were working solely with non-compiled scripts. But with this beta, you can also specify a fully-qualified name of the precompiled class implementing your extension:

Type checking extensions now also support two more events: ambiguousMethods and incompatibleReturnType. 

Groovysh enhancements

Groovysh has been expanded with various enhancements:

  • support for code completion in various places, like imports, package names, class names, variable names, parameter names, keywords, etc.

  • a doc command allows you to open the relevant JavaDoc and Groovy GDK web pages to have more information for a given class, for example try in Groovysh:
    doc java.util.List

  • you can complete file names inside strings, particularly handy for your scripting tasks where you want to open a file with new File("data.|”) (where the pipe character is the position of your cursor), and then hit the TAB key to have the completion of the file name

OSGi manifests for the “invoke dynamic” JARs

If you’re using Groovy in the context of an OSGi container, the Groovy JARs contained the right OSGi metadata information in its manifest. However, it wasn’t the case for the “invoke dynamic” JARs, as the underlying library used by the Gradle OSGi plugin wasn’t supporting JDK 7 bytecode. Fortunately, this deficiency has been fixed, the Gradle OSGi plugin updated, and we’re now able to have our “indy” JARs work fine under OSGi has well.

Those changes have not yet been backported to the Groovy 2.1.x branch, but will likely be. We’re looking forward to hearing your feedback, for those using Groovy and OSGi.

For more details about the various bug fixed in those releases, please have a look at the JIRA release notes:

And then, go download Groovy 2.2-beta-1 and Groovy 2.1.6 on our Download area while it's hot!

Thanks a lot for all your contributions, and we’re looking forward to your feedback on those releases.


Dear all,

I'm pleased to announce the release of Groovy 2.1.5.

Groovy 2.1.5 is a bug fix release of the Groovy 2.1 branch. In particular, it fixes a problem we've encountered with Groovy 2.1.4 where the extension module descriptors were not found in the "all" JAR, which meant that the usual nice GDK methods extensions for XML and other modules were not found by Groovy.

You can download Groovy 2.1.5 in the download area and have a look at the JIRA release notes.

Thanks to all who contributed to this release!

Keep on groovy'ing!

Groovy 2.1.4 released

The Groovy development team is pleased to announce the release of Groovy 2.1.4.

Groovy 2.1.4 is essentially a bug fix release of our 2.1 branch, and you can dive into the details in our JIRA release notes.

You can get the distribution in our download area.

Thanks a lot to all those who contributed to this release, and we're looking forward to hearing your feedback!

The Groovy team is always looking at ways to further improve and encourage the collaboration and contributions from the community.
Today, the we are looking for a sponsor for a dedicated server that would host our new Continuous Integration server. If you or your company is interested in helping Groovy by contributing hardware and/or hosting, please contact us.
On behalf of the Groovy team, thanks in advance for your help and support!
We're looking forward to hearing from you.
Heads up on a joint bug-fix release, with Groovy 2.0.8 and 2.1.3.
We released the 2.0.8 bug fix in particular for Grails which was affected by a couple issues but that hadn't planned on migrating just yet to the 2.1.x line.
If you want to learn more about the issues closed, please have a look at the JIRA release notes for Groovy 2.0.8 and Groovy 2.1.3
Head down to the Download section to download our the latest releases.
Thanks for all your contributions, and keep on groovy'ing!

The Groovy development team is happy to announce the joint releases of Groovy 1.8.9, 2.0.7, and 2.1.1!

Those three releases are essentially bug fix releases.
You can have a look at the JIRA issues we tackled here:
Head over to the Groovy distribution area to download the Groovy distributions and documentation.
Some further notes about our current releases and branches:
Groovy 1.8.9 is the last planned update for the 1.8 versions of Groovy unless critical bugs arise. 
When resolving bug requests we may not automatically apply them to the 1.8 versions of Groovy as we are trying to focus on later releases when we can and backporting some of the fixes can be a little tricky. 
However, if you have a critical bug and are unable to upgrade, please indicate that in the relevant jira issue and we will try to take that into account when resolving issues. 
Of course patches/pull requests against the 1_8_X branch are also welcome! :-)
Releasing Groovy 2.0.7 wasn't strictly necessary as upgrading to Groovy 2.1.1 is straightforward but we wanted to make a formal last release for the 2.0.x branch. 
And going forward, bug fixes will be targeted at both 2.1.x and 2.2 lines, and only 2.2 will get any new features that may come, but we don't anticipate that 2.0.x will get further fixes as the 2.1.x line supersedes that branch.

Thanks a lot to all those who contributed to this release, and we're looking forward to hearing about your feedback!

InfoQ interview Groovy project lead Guillaume Laforge about the recent release of Groovy 2.1.

In this interview, the discussion centered around the new features of that release, including coverage of the "invoke dynamic" support, performance, meta-annotations, compiler configuration, and more.

Groovy 2.1 released
The Groovy team is pleased to announce the release of Groovy 2.1.0.
With over 1.7 million downloads in 2012, a strong ecosystem, Groovy continues its development and adoption, refines existing features and evolves new ones.
In this new release, Groovy 2.1:
  • offers full support for the JDK 7 “invoke dynamic” bytecode instruction and API,
  • goes beyond conventional static type checking capabilities with a special annotation to assist with documentation and type safety of DSLs and adds static type checker extensions,
  • provides additional compilation customization options,
  • features a meta-annotation facility for combining annotations elegantly,
  • and provides various other enhancements and minor improvements.
Please read all the details about the new features and improvements in the Groovy 2.1 release notes document:
You can download Groovy 2.1.0 from the Download area:
And have a look at the JIRA tickets we worked on:
Thanks a lot to all our users, contributors and committers who made this release possible.
I'd particularly like thank our new committers: Pascal Schumacher, André Steingreß and Tim Yates, for all their feedback and various contributions. Welcome to the team!
The Groovy team is looking forward to your feedback on this new release!
Keep on groovy'ing!
The Groovy team is pleased to announce the second release candidate of Groovy 2.1.0.
The final release is merely days away, so please be sure to test that release and give us your feedback, before we go gold.
Unless really critical bugs or regressions arise, we're aiming at going final next week or the following.
Download and try Groovy 2.1.0-rc-2 here:
The JIRA release notes:
As a reminder of what's coming, here's what you can expect from Groovy 2.1:
  • complete invoke dynamic support when running with the "indy" JAR on JDK 7
  • upgrade to GPars 1.0: the Groovy distribution now bundles the GPars 1.0 final release
  • @DelegatesTo annotation: to help IDEs and the static type checker and compiler to know that method calls in a method parameter closure are delegated to another parameter of the method -- nice for DSLs like in Gradle build files
  • custom type checking extensions: so you can type check your DSLs at compile-time with your own logic
  • meta-annotation system: which allows you to define a new annotation actually combining several others -- which also means being able to apply several AST transformations with a single custom annotation
  • custom base script class flag for the groovyc compiler: to set a base script class when compiling Groovy scripts
  • compiler configuration script: to let you define various configuration options for the Groovy compiler, like specifying custom file extensions, various compilation customizers to apply, etc.
  • compilation customizer builder: a special builder for specifying compilation customizers
  • jar://, file://, http:// prefix support for launching Groovy scripts from the command line
  • and many bug fixes and various minor improvements
Thanks a lot for your great contributions, in whichever form it takes, and particular thanks to some of our most prolific contributors sending us frequent patches and pull requests: André Steingreß, Tim Yates, and Pascal Schumacher.

As promised before the Christmas / New Year's Eve break, I'm happy to announce the availability of the Release Candidate for Groovy 2.1.0.

Please be sure to test that release and give us your feedback, before we go final.
Unless really critical bugs or regressions arise, we're aiming at going final by the end of the month.
Download and try Groovy 2.1.0-rc-1 here:
The JIRA release notes:
As a reminder of what's coming (pending the final release notes document), here's what you can expect from Groovy 2.1:
  • complete invoke dynamic support when running with the "indy" JAR on JDK 7
  • upgrade to GPars 1.0: the Groovy distribution now bundles the GPars 1.0 final release
  • @DelegatesTo annotation: to help IDEs and the static type checker and compiler to know that method calls in a method parameter closure are delegated to another parameter of the method -- nice for DSLs like in Gradle build files
  • custom type checking extensions: so you can type check your DSLs at compile-time with your own logic
  • meta-annotation system: which allows you to define a new annotation actually combining several others -- which also means being able to apply several AST transformations with a single custom annotation
  • custom base script class flag for the groovyc compiler: to set a base script class when compiling Groovy scripts
  • compiler configuration script: to let you define various configuration options for the Groovy compiler, like specifying custom file extensions, various compilation customizers to apply, etc.
  • compilation customizer builder: a special builder for specifying compilation customizers
  • jar://, file://, http:// prefix support for launching Groovy scripts from the command line
  • and many bug fixes and various minor improvements
Thanks a lot to all the contributors to this release!
And on behalf of the team, I wish our Groovy users all the best for 2013!

Since the world didn't seem to end today, it is with great pleasure that we bring under your Christmas tree the following presents: the release of Groovy 2.1.0-beta-1 and Groovy 2.0.6.

Groovy 2.0.6 is a bug fix release for our Groovy 2.0.X line, whereas Groovy 2.1.0-beta-1 contains new features.
You can download Groovy at the usual location:
The JIRA release notes can be found here:
More extensive release notes will be available for the final Groovy 2.1.0 release, but please let me highlight the following key new features:
  • complete invoke dynamic support when running with the "indy" JAR on JDK 7
  • upgrade to GPars 1.0: the Groovy distribution now bundles the GPars 1.0 final release
  • @DelegatesTo annotation: to help IDEs and the static type checker and compiler to know that method calls in a method parameter closure are delegated to another parameter of the method -- nice for DSLs like in Gradle build files
  • custom type checking extensions: so you can type check your DSLs at compile-time with your own logic
  • meta-annotation system: which allows you to define a new annotation actually combining several others -- which also means being able to apply several AST transformations with a single custom annotation
  • custom base script class flag for the groovyc compiler: to set a base script class when compiling Groovy scripts
  • compiler configuration script: to let you define various configuration options for the Groovy compiler, like specifying custom file extensions, various compilation customizers to apply, etc.
  • compilation customizer builder: a special builder for specifying compilation customizers
  • jar://, file://, http:// prefix support for launching Groovy scripts from the command line
Although more details will be provided later on for the final release, please don't hesitate to ask questions about those new features and improvements till then.
A little reminder on the roadmap, we intend on releasing a release candidate of Groovy 2.1 the second week of January, and if all goes well (if we don't need another RC for some last minute issues), we'll go straight to the final release at the end of January.
Thanks a lot for your feedback, your bug reports, your contributions, your pull requests!
It's with such a great community of users that we make Groovy a joy to use in our every day projects.
The whole development team joins me to wish you the best for the holidays and for next year!
A Groovy Christmas and a Happy New Year to all!

InfoQ is running a reader-driven research about JVM languages. If you like Groovy, don't forget to vote for us (smile)

Groovy project manager, Guillaume Laforge, recently presented an online webinar on Groovy 2.0.

You can watch it on SpringSource's Dev channel on YouTube: What's new in Groovy 2.0?

And you can have a look at the slides on Slideshare.

Groovy 2.0.4 released
The Groovy development team's just released Groovy 2.0.4, a bug fix for our Groovy 2.0 branch.
It fixes some important issues we've had with generics with the stub generator, as well as several fixes related to the static type checking and static compilation features. We also worked on the recompilation issues with the GroovyScriptEngine.
You can download Groovy 2.0.4 here:
The artifacts are not yet on Maven Central, but will shortly.
Also, the online JavaDoc and GroovyDoc are still being uploaded as I write this, but will hopefully be online in a few hours.
You can have a look at the issues fixed in this release on JIRA:
If you're curious why we've jumped from 2.0.2 to 2.0.4, skipping 2.0.3, it's because of some issues with the release of 2.0.3 which I had mistakenly built with JDK 6 instead of JDK 7, which ruled out all our invoke dynamic support. So we quickly moved to 2.0.4.
We'll certainly also release a 1.8.9 soon, especially for the stub generator fixes which might be useful for those affected with the issues we've fixed.
This is with great pleasure that the Groovy development team announces the releases of Groovy 2.0.2 and Groovy 1.8.8

Those two releases are essentially just bug fix releases, with only minor improvements. In particular, work has been done in the area of the static type checker and static compilation, in the GroovyScriptEngine, as well as further performance improvements for the "invoke dynamic" support as well as plain Groovy. We also upgraded the version of GPars of the distribution to use the newly released 1.0-beta-3.
For the details of both releases, please have a look at the JIRA changelog here: for Groovy 2.0.2: http://bit.ly/gr202, and for Groovy 1.8.8: http://bit.ly/gr188

As usual, you can download Groovy in our download area: http://groovy.codehaus.org/Download
Thanks a lot to all those who contributed to those releases.

I'd also like to seize this opportunity to highlight our contribution page, to those who are interested in contributing to Groovyhttp://groovy.codehaus.org/Contributing

Going forward, we're going to propose a list of JIRA issues you might have a look at, if you want to get started working on the Groovy project: http://bit.ly/gcontrib

And on the contribution page mentioned above, at the bottom of the page, we feature a table containing wider goals or side projects that you might be interested in contributing to. 

So don't hesitate to come back to us with ideas or with questions regarding those possible areas of contributions, and we'll gladly welcome your help!