Details
Description
The annotation @GroovyASTTransformationClass marks another annotation as an AST Transformation. The annotation has a required parameter, a String[]. The parameters stores the fully qualified class name that will be invoked during the transformation phases.
As a convenience, the parameter type should be Class[] instead of String[]. It allows programmers to specify a class not a String that represents a class.
We cannot remove String[] because that would break backwards compatibility. We could add a 2nd parameter and then require 1 (and only one) of the two parameters to be specified.
The was originally requested by Venkat Subramanium at 2gx 2009.
Attaching a patch for review that allows AST transforms to annotated using the class references as an alternative to using the String class names. There is no backwards compatibility broken - in specifying ast transforms by class name strings - as indicated by no failures in the test suite run.
Here is the summary of changes:
1) GroovyASTTransformationClass - This annotation now allows a new attribute "classes" of type Class[]
2) ASTTransformationCollectorCodeVisitor - Modified to collect the ast transform classes - either using class names or class references. Also errors out if neither class names nor classes are specified or if both are specified.
3) G3839Transform1/G3839Transform2/G3839Transform3 - Dummy transforms that add fields f1/f2/f3 to the class that they are annotated on.
4)