Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7-beta-1
-
None
-
All
Description
Groovy should support annotations on local variable declarations. It is syntactically legal to annotate a local variable, but the AST produced does not carry that annotation.
My use case with the AST builder. Either we'd like to annotate a local variable, like this:
@AstSource(CompilePhase.CONVERSION)
def source = { println "compiled on: ${new Date()}" }
Or annotate a property within a closure (which is a DeclarationExpression), like this:
def result = new AstBuilder().build { phase = CompilePhase.CONVERSION @AstSource source = { println "compiled on: ${new Date()}" } }
A getAnnotations() method should probably be added to DeclarationExpression to support this.
Attachments
Attachments
Issue Links
- is related to
-
GROOVY-3952 CLONE -Groovy Support for annotations on local variable declarations: Part II - Allow Local Transforms to process such annotations
- Closed