Paolo Di Tommaso | 15 Nov 12:11 2014

[groovy-user] Can't override equals method for Lists

I'm need to override the equals method a custom List class so that it does not check for entries order. 

But it turns out that my custom equals method is never invoked. 

Bellow you can find my test case: 

class UnorderedList<E> {

    <at> Delegate()
    List target

    UnorderedList( Collection items ) {
        target = items != null ? new ArrayList(items) : []

    UnorderedList( Object ... items ) {
        this(items as List)

    <at> Override
    boolean equals(Object o) {

        if (
            return true;

        if (!(o instanceof UnorderedList))
            return false;

        Collection other = ((UnorderedList)o).target
        if (other.size() != target.size())
            return false;

       return target.containsAll(other);
    <at> Override
    int hashCode() {
        int h = 0;
        Iterator<E> i = target.iterator();
        while (i.hasNext()) {
            E obj =;
            if (obj != null)
                h += obj.hashCode();
        return h;

def x = new UnorderedList(1,2,3)
def y = new UnorderedList(3,1,2)

assert x.hashCode() == y.hashCode()
assert x.equals( y )
assert x == y 

Assertion failed: 

assert x.equals( y )
       | |       |
       | false   [3, 1, 2]
       [1, 2, 3]

Is there any way to override the equals method for a List subclass? 

Goud, Venkat | 13 Nov 19:51 2014

[groovy-user] Weird AST behavior

I am trying to get an AST example work for my project. The project compiles fine but the annotations only work when run as part of a script. 

<at> Retention(RetentionPolicy.SOURCE) <at> Target([ElementType.METHOD]) <at> GroovyASTTransformationClass(classes=[WithLoggingASTTransformation.class]) public <at> interface WithLogging { } <at> GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS) public class WithLoggingASTTransformation implements ASTTransformation { //inserts a print statement before and after just like the <at> WithLogging example //skipping the implementation details as those are not the issue here.. 

This doesnt work:
//this doesn't work i.e the inserted println doesn’t get printed //this doesn't work class AnotherTest { <at> WithSubject void greet() { println "greeting is called" } }
This works!!!!
//contents of the test.groovy script file that works <at> WithLogging void greet() { println "greeting is called" } greet() This shouldn’t matter but here is my build.gradle apply plugin: 'groovy'

sourceCompatibility = 1.5
version = '1.0'

repositories {

dependencies {
// compile "org.codehaus.groovy:groovy-all:2.3.6"
compile "org.codehaus.groovy:groovy:2.3.6"
compile 'org.apache.shiro:shiro-core:1.2.3'
testCompile group: 'junit', name: 'junit', version: '4.11'
Denis Murashev | 13 Nov 17:50 2014

[groovy-user] New version of groovy-eclipse-compiler


New versions of groovy-eclipse-compiler 2.9.1-01 and groovy-eclipse-batch 2.3.7-01 are about to be released.

Those components can be accessed on Codehaus staging repo:

Looking forward your feedback.

Thank you,


Guillaume Laforge | 11 Nov 19:39 2014

[groovy-user] [ANN] Groovy Weekly #44

Hi all,

Before heading to the Devoxx conference in Belgium, it's time I publish Groovy Weekly!

My pick of the week:
  • ElasticSearch 1.4 released with the new default Groovy language scripting support
  • Gradle 2.2 released
  • and the dates of the Greach conference in Spain announced, with the call for paper open
Enjoy and keep on groovy-ing!

Guillaume Laforge
Groovy Project Manager
Pivotal, Inc.

nabblee | 10 Nov 00:46 2014

[groovy-user] Upgrading Groovy and Java on an existing application?

I have a pretty hefty application (about 200 classes, I would estimate) the
currently compiles with Groovy 2.0 and runs on Java 1.7.0_40.

I would like to start using Meteor for the UI, which means exposing some of
my Groovy application data using DDP.  There is a Java DDP client at, but it requires Java 8.

So, I'm facing the prospect of upgrading Groovy and Java, and I'm very
concerned that my application will never run again.

Should this be a smooth process, or am I asking for trouble jumping all the
way to Groovy 2.3 and Java 1.8?

Thanks for any advice, for or against.  (I'm open to other suggestions
regarding Meteor DDP integration, as well.)

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

To unsubscribe from this list, please visit:

Jochen Eddelbüttel | 9 Nov 22:02 2014

[groovy-user] BaseScript Annotation and IntellJ type inference - so grooovy!

I’ve extended Script with a couple of methods that all look like this:


import any.old.organisation.WeirdObject


WeirdObject getWeirdObject() {




Now a single line with a BaseScript Annotation pointing to my extended Script class lets Intellj know what type those otherwise miraculous binding variables have.


I’ve applied that to scripts for the GroovyServlet. Now I can type “request.” or “response.” and get the whole glory of code completion and type inference!!


Before I had imports and assignments to typed local variables for this purpose. This approach nicely reduced that boilerplate.


Just wanted to post something useful to give back to the community. I’ve just put together a web application with Angular.js frontend and a Groovy backend for the JSON data. My boss was pretty perplexed, when I said the prototype was ready on day two. I’ve created a servlet based on the original Groovy servlet that injects a connection to our own backend in to the scripts. Now I just need to pump information from our proprietary objects (legacy Java APIs made Groovy through extensions) into the ScreamingJsonBuilder. It rocks. 5 scripts of less than 100 lines for the backend; 1 HTML, 1 CSS and 1 JS for the front end, neither in access of 100 lines again.







Jochen Eddelbüttel | 9 Nov 21:44 2014

[groovy-user] StreamingJsonBuilder > 2.3.x: Why call(Collection, Closure) not call(Iterable, Closure)

Hi G8 community,


I’ve been absent from the list for a while. I’ve noticed that StreamingJsonBuilder is not only supposedly much faster, but also finally offers a way to create Array/List output in a sensible fashion.


But in my first real life application I have objects providing an Iterator (thus being an Iterable). But they don’t implement Collection.


Can somebody give me a reason, why this feature has not been made available for the more general Iterable interface? Andrey B?


I mean, the inner workings of the new implementation would not look any different for an Iterable:


        boolean first = true;

        for (Object it : coll) {

            if (!first) {


            } else {

                first = false;




            curryDelegateAndGetContent(writer, closure, it);






And I don’t see any confusion with other parameter combinations for the call methods. I’d advocate going from Collection to Iterable in a future release of Groovy. Any comment?


Both workarounds for the Iterable at hand are not very pretty


Calling asList() defies the whole purpose of the streaming exercise, i.e. not building data structures before streaming.


json (iter as List) {




The Iterable at hand has a count property, so this should give better performance, but looks clumsy:


               json (0..<iter.count) {

                              def item = iter.getItem(it)




Thanks for any insight. Keep the grooviness coming!



Marcel Wagner | 7 Nov 11:42 2014

[groovy-user] Call site caching faster than invokedynamic?

We have a relative complex business application, where some layers are 
written in groovy. We try to switch from call site caching groovy (2.3.6 
on 8u25) to the indy version. One task running in the call site caching 
version 30 seconds jumps up to 3 minutes in the indy version and the 
CPU's on the app server jumps up to 90% usage. The code area in question 
seems to use heavyly nested each closures with more each and findAll 
calls. My question is now, should the indy version always be faster than 
the call site version? Is it worth to isolate a test case for this?


To unsubscribe from this list, please visit:

guindous | 6 Nov 19:23 2014

[groovy-user] Interrupt groovy sql (statement.cancel() like)

Hi everybody! This is my first post to the list, so be patient if I sound too
beginner. :D

I've been looking for a nice "groovy way" to interrupt/cancel/kill/stop a
long running query executed using the groovy.sql.Sql class. The main idea is
to achive similar functionality to this post (
but I don't want to stop using the groovy sql methods like sql.executeUpdate
or sql.execute. There is any way to accomplish this? Any idea is

Thanks in advance! 

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

To unsubscribe from this list, please visit:

Steve Amerige | 6 Nov 18:45 2014

[groovy-user] Customizing Groovydoc: Tagging for Faceted, Top-Down Searching/Code Discovery

Hi all,

Groovydoc is great, but it is generally useful as a bottom-up reference.  We want to modify/extend Groovydoc so that the generated html allows for faceted searching based on a new tag: <at> tag.  Tagging source code with keywords will transform Groovydoc from generating only reference material to also generating documentation useful for code discovery by end users.

We'd like to customize the behavior of Groovydoc to recognize a new tag that changes the resulting generated html.  Specifically, we'd like to have:

    <at> tag taglist


    taglist     : tag (',' tag)*;            // mutually-exclusive tags
    tag         : keyword+ ('>' keyword+)*;  // allow for child tags
    keyword     : KEYWORD;
    KEYWORD     : [_a-zA-Z][_a-zA-Z0-9-]*[_a-zA-Z0-9]*;

For example:
<at> tag color>conversion hsl rgb, analytics
Perform color conversion between hsl and rgb, supporting underlying analytics.
If the above precedes a method, the method will be tagged with the given keywords.  The generated html would have a new link at the top of the page Search that would open a page to provide for faceted searching of <at> tag content as well as <at> version and other content.

Perhaps there is already something that generates top-down information with some kind of searching for groovydoc that enables programmers to look for reusable code that might be just what they need.  If not, I'd like to move forward with the above and would appreciate any feedback.


Steve Amerige
Principal Software Developer, Fraud and Compliance Solutions Development
SAS Institute, 940 NW Cary Pkwy #129, Cary, NC 27513-2792

pauldailly | 5 Nov 22:49 2014

[groovy-user] MarkupTemplateEngine internationalization support

Hi there,

I have been playing around with the MarkupTemplateEngine available in Groovy
2.3. In particular I am interested in the internationalization support it
offers. I have put together a small example (shown below) whereby, when a
template file named "greeting-fr-FR.tpl" exists, this template's contents
are retrieved.

TemplateConfiguration templateConfiguration = new TemplateConfiguration()
templateConfiguration.setLocale(new Locale("fr-FR"))
MarkupTemplateEngine templateEngine = new
Template template =
Writable output = template.make([person: person])
println(output.writeTo(new StringWriter()).toString())

However, I am wondering whether it is possible for the templating engine to
perform some form of 'closest match' template file resolution. Currently, if
I specify the locale of the TemplateConfiguration object to be "fr-FR", but
I only have template files named "greeting.tpl" and "greeting-fr.tpl", the
file "greeting.tpl" is used. I would like "greeting.-fr.tpl" to be the
template file resolved in this case. Is this possible?

Many thanks,


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

To unsubscribe from this list, please visit: