Martin Gropp | 2 Mar 18:48 2015

[groovy-user] <at> Field and closures: strange behavior

Hi everyone!

I have run into a little problem with  <at> Field-annotated variables in a
Groovy script and writing to them from inside a closure.

Being rather new to Groovy I'm not sure if this is a bug, but at least
it's really confusing and I'm stuck… :/

Here is an example:

>  <at> groovy.transform.Field
> def x = 1;
> // This works:
> // x = 2;
> // { -> this. <at> x = 2; }();
> // This doesn't:
> { -> x = 2; }();
> { -> println x }();        // prints 2
> { -> println this.x }();   // prints 2
> { -> println this. <at> x }();  // prints 1
> println x;                 // prints 1
> println this.x;            // prints 1
> println this. <at> x;           // prints 1
> def script = this;
> {
(Continue reading)

antoaravinth | 2 Mar 15:32 2015

[groovy-user] Gradle Issue when building Groovy from source.

I'm trying to build groovy from source, using:

gradle --stacktrace clean dist

and its giving me:

cannot be cast to
(Continue reading)

Peter Niederwieser | 2 Mar 15:04 2015

[groovy-user] [Ann] Spock 1.0 has been released

Dear Groovy Community,

I'm happy to announce that Spock 1.0 has been released. Read all about it here:


PS: Make sure to follow our new Twitter Account!

[groovy-user] How does groovy detect a line break

     How does groovy detect a line break even without keeping a

Jitendra Singh

View this message in context:
Sent from the groovy - user mailing list archive at

To unsubscribe from this list, please visit:

Maciej Górski | 1 Mar 20:57 2015

[groovy-user] [Android] Crash when assigning to "result" variable in a class extending Activity


I have a weird issue, when assigning to a variable called result, the app crashes with:

Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'boom!' with class 'java.lang.String' to class 'int'

Relevant code:

<at> CompileStatic
public final class HomeActivity extends ActionBarActivity {

    private String result

    <at> Override
    protected void onCreate(Bundle savedInstanceState) {
        this.result = "boom!"

The crash does not happen when I omit "this." before result.

I looked through the code of base class, base class of base class, base class of base class of base class and base class of base class of base class of base class (yeah, Android) and the only code there that could be causing this is RESULT_OK / RESULT_CANCELLED of type int. Documentation here:

Any ideas why this happens?

Maciej Górski

Andres Almiray | 1 Mar 12:35 2015

[groovy-user] [ANN] Griffon 2.2.0 released!

The Griffon team is happy to announce the release of Griffon 2.2.0!

The following list summarizes the changes brought by this release:

 * An application wide Context that can be used t store key/value pairs.
 * MVCGroups can have their own contexts too.
 * MVCGroups now expose their parent group (if not null).
 * `Configuration` instances can be made writable by wrapping them with `MutableConfiguration`.
 * *breaking change!* Metadata, Environment and RunMode are no longer magic singletons.
   Instances of these classes can now be injected using `javax.inject.Inject`.
 * Updates to JavaFXUtils.

A more detailed description of the changes and compatibility issues can be found at the release notes.

We look forward to your feedback. Please report any problems you find to the Griffon User list, or better yet, file a bug at

Remember you can also contact the team on Twitter: <at> theaviary.

Many thanks to all who contributed to this release!

The Griffon Team

OC | 28 Feb 09:57 2015

[groovy-user] Closures and it

Hello there,

the documentation says

this code:

def greeting = { "Hello, $it!" }
is stricly equivalent to this one:

def greeting = { it -> "Hello, $it!" }

First, presumably there's a typo, and it should be “strictly”. What's much more important, my
dictionary says “strictly” should mean in this context “with no exceptions; completely or
absolutely” -- and that is simply not true:

4 /tmp> <q.groovy 
2.times {
  it.times {
    println it
5 /tmp> groovy q 
6 /tmp> <q.groovy
2.times { it ->
  it.times { it ->
    println it
7 /tmp> groovy q 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/private/tmp/q.groovy: 2: The current scope already contains a variable of the name it
  <at>  line 2, column 12.
     it.times { it ->

1 error

8 /tmp> 

As a side-note, let me please again point out that in my opinion, this should be fixed, and Groovy should
allow the latter variant like C-based languages do (not just with “it”, but with any variable; not
just with a closure, but with all kinds of scoped blocks); the Java approach which prevents obscuring a
variable in a nested scope is, in my personal opinion, simply wrong -- one of so many attempts to make the
language “safer” which, in fact, makes it only inconvenient and in practice unsafe (since e.g., when
copy/pasting code, one has to rename variables).

All the best,

To unsubscribe from this list, please visit:

antoaravinth | 27 Feb 14:02 2015

[groovy-user] Help In Solving The bug GROOVY-7257

I’m trying to solve the bug that is mentioned over here:

Looks like if he runs the groovy doc tool with public argument and he
 <at> PackageScope in a variable/method, it also comes in the documentation.
Something like this:

groovydoc -public -d ./doc/ GROOVY-7257.groovy

generates documentation for all the fields, regardless of  <at> PackageScope

I tried to walkthrough the code base and found the issue is the code-base
isn’t checking the arguments at all (or I might be wrong here). The class
SimpleGroovyClassDocAssembler does the job of visiting and setting the
properties of the source file passed. In the methods like visitVariableDef,
visitMethodCall it doesn’t check the properties (instance variable which has
the arguments passed while groovydoc command is called , passed down from class). 

Looks like we need to add checks over there in the methods, according to the
groovydoc specification. 

Can I write them and give a PR. Or I’m missing some information here :)

View this message in context:
Sent from the groovy - user mailing list archive at

To unsubscribe from this list, please visit:

Batman | 27 Feb 09:11 2015

[groovy-user] Couldnt able to compile groovy from local source.

Hi I have checked out the Groovy project from github. 

And my git log gives me the last commit as: 

git log -n 1 
commit 80e01f03399908f52e892356564c67073de3ab2a 
Author: Cedric Champeau <cedric.champeau@...>
Date:   Thu Feb 26 17:32:00 2015 +0100 

    Documentation for object graph builder 

But when I try to compile and build the dist: 

gradle clean dist 

I get the error: 

To honour the JVM settings for this build a new JVM will be forked. Please
consider using the daemon: 
:buildSrc:compileJava UP-TO-DATE 
:buildSrc:compileGroovy UP-TO-DATE 
:buildSrc:processResources UP-TO-DATE 
:buildSrc:classes UP-TO-DATE 
:buildSrc:jar UP-TO-DATE 
:buildSrc:assemble UP-TO-DATE 
:buildSrc:compileTestJava UP-TO-DATE 
:buildSrc:compileTestGroovy UP-TO-DATE 
:buildSrc:processTestResources UP-TO-DATE 
:buildSrc:testClasses UP-TO-DATE 
:buildSrc:test UP-TO-DATE 
:buildSrc:check UP-TO-DATE 
:buildSrc:build UP-TO-DATE 
Using Java from
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre (version
Detected development environment 

FAILURE: Build failed with an exception. 

* Where: 
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle' line:

* What went wrong: 
Could not compile script
> startup failed: 
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle': 2:
unable to resolve class groovy.text.markup.TemplateConfiguration 
    <at>  line 2, column 1. 
     import groovy.text.markup.TemplateConfiguration 

'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle': 1:
unable to resolve class groovy.text.markup.MarkupTemplateEngine 
    <at>  line 1, column 1. 
     import groovy.text.markup.MarkupTemplateEngine 

  2 errors 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output. 


Total time: 11.37 secs 

The import in the quality.gradle in the path /gradle/quality.gradle is what
causing issue. 

Since I have checkout the project from repo, not sure, why I'm facing this

View this message in context:
Sent from the groovy - user mailing list archive at

To unsubscribe from this list, please visit:

Martin d'Anjou | 27 Feb 05:13 2015

[groovy-user] Unable to resolve enum

Groovy is unable to resolve the inner enum. This is strange because when 
I remove the Lib.Width variable declaration, it works.

import Lib
class UserPlugin {
   public static void main(String[] args) {
     // No issue printing this one if the LibWidth declaration is 
commented out

     // But the following line fails
     Lib.Width w

class Lib {
   enum Width { ONE(1), TWO(2) }

groovy-2.4.1/bin/groovy -cp lib UserPlugin.groovy

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
/mnt/homes/home/martin/tmp/groovy_dynclass_loading/UserPlugin.groovy: 6: 
unable to resolve class Lib.Width
   <at>  line 6, column 15.
        Lib.Width w

Can this be solved without compiling the code and leaving it all scripted?


To unsubscribe from this list, please visit:

Martin d'Anjou | 27 Feb 03:02 2015

[groovy-user] How to use import inside a dynamically loaded groovy file

I am stumped, so I posted my question on stackoverflow

Any help appreciated.


To unsubscribe from this list, please visit: