The new @Builder annotation with ExternalStrategy in Groovy 2.3.1 still result in compilation error if build with Gradle (1.12, 1.11)

I just verified http://jira.codehaus.org/browse/GROOVY-6774, which has been fixed in 231, but when I tried ExternalStrategy, I got the following error:

E:\dev\content\test-ws\ii-13-groovy230-test\hello-groovy230-gradle\src\main\groovy\ClassABuilder.groovy: 7: The builderStrategy class ‘groovy.transform.builder.ExternalStrategy’ on @Builder is not a builderStrategy

@ line 7, column 1.

@Builder(builderStrategy=ExternalStrategy, forClass=ClassA, prefix=‘with’)

^

This is ClassABuilder class definition: @Builder(builderStrategy=ExternalStrategy, forClass=ClassA, prefix=‘with’) class ClassABuilder {}

I guess this is still a Groovy bug, but I’m not familiar how to debug Groovy+Gradle.

Thanks in advanced.

Are you saying that it now works with the default strategy, but doesn’t work when a strategy is explicitly specified? Can you double-check this?

Thanks for quickly reply,

Actually, Yep, the default strategy works fine, please see below:

@Builder

class ClassA {

long ts

String name

}

And this is the test for external strategy:

class ClassA {

long ts

String name

}

@Builder(builderStrategy=ExternalStrategy, forClass=ClassA, prefix=‘with’)

class ClassABuilder {}

Thanks for the feedback. I’ve commented on GROOVY-6774 to have this fixed as well.

On Groovy’s master and 2_3_X branches there should be a fix to this. If you are in a position to test a snapshot version (built automatically by the CI server) that would be great.

I verified on 240- and 232-snapshot according to the cases in the doc as below: http://beta.groovy-lang.org/docs/groovy-2.3.0/html/documentation/#xform-Builder

It looks should be fixed this time, thanks for you guys’ rapid feedback.