I clean generated .class files, and re-build my app. If the first call to generated AST constructor happens from a .java class, I get an error. But if I call a constructor generated by an @Immutable
annotation in a .groovy class first, it becomes visible to .java classes since bytecode is already generated and no errors occur.
So I am wondering how do I set up gradle so it compiles all groovy classes with needed AST transformations first, so i can use it from .java classes properly? Also, how do I use @Builder
-generated code from .java classes, since javac doesn't see any ClassName.bulder()
method?
Here is my .groovy class with ASTT
@Immutable class A { String a; }
Here is how I call its constructor from .java class
public class Test { A b = new A("321"); }
And the error I get:
Error: "constructor in class [skipped] cannot be applied to given types; required: no arguments found: [skipped] reason: actual and formal argument lists differ in length".
I am using Intellij IDEA 14.4 and Gradle to build.