groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josedeoliveiraguimaraes@gmail.com <josedeoliveiraguimar...@gmail.com>
Subject question on AST transformations
Date Thu, 31 May 2018 21:57:24 GMT

   I am writing an article on metaprogramming and have several questions on Groovy. I would
thank any help with them.

   1. Is there any example in which @GroovyASTTransformationClass takes an array with more
   than one element? Something like this:
   
       @Retention(RetentionPolicy.SOURCE)
       @Target([ElementType.TYPE])
       @GroovyASTTransformationClass( [FirstTransformation, SecondTransformation] )
       @interface MyAnnot { }
   
   I could not find one. If this is possible, I suppose that a single annotation
   can apply transformations in several compiler phases.

   2. Suppose I want to use the annotation WithLogging of
        http://groovy-lang.org/metaprogramming.html#developing-ast-xforms
   All I have is the Groovy compiler, a .exe file. What do I do? The general question is:
how the Groovy compiler finds a **local** AST transformation class? For global transformation
the page above says

   Compiled classes that implement global transformations are in a JAR added to the classpath
of the compiler and contain service locator file META-INF...

   But for local transformations, there is no such observation.

Mime
View raw message