I'm trying to run the simple @Builder example shown on the Groovy 2.3 release page, using IntelliJ Idea 13.1.1.
Having created a vanilla groovy project and pasted the code, I get the following warnings where @Builder is declared on the Person class:
Missed attributes: forClass, prefix, builderClassName, buildMethodName, builderMethodName
(Essentially all the properties which don't have default values.)
The IDE is then also not seeing the builder()
method which by default should have been added to the Person class, suggesting the AST hadn't been applied.
When the script is actually executed, it behaves as expected. So why do I see those errors in the IDE?
Update:
If I try to build from Gradle I get the following error during groovy compilation:
Can't load builderStrategy 'groovy.transform.builder.DefaultStrategy' java.lang.ClassCastException: groovy.transform.builder.DefaultStrategy cannot be cast to org.codehaus.groovy.transform.BuilderASTTransformation$BuilderStrategy
@ line 3, column 1.
@Builder
If I try to switch to SimpleStrategy instead of the DefaultStrategy I get:
The builderStrategy class 'groovy.transform.builder.SimpleStrategy' on @Builder is not a builderStrategy
@ line 4, column 1.
@Builder(builderStrategy = SimpleStrategy)