[ 
https://issues.apache.org/jira/browse/GROOVY-3952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17346204#comment-17346204
 ] 

Paul King commented on GROOVY-3952:
-----------------------------------

Yes, we can keep this resolved. Those annotations are in the AST but we don't 
write any of them into bytecode at present. Java and Kotlin don't write out 
local variable annotations into the bytecode. Java at least (haven't checked 
Kotlin) does write out type annotations for local variables. That is something 
I plan to look at. We write out other type annotations in AsmClassGenerator but 
write local variables in CompileStack. We'll need a few tweaks to make it work 
given that.

> CLONE -Groovy Support for annotations on local variable declarations: Part II 
> - Allow Local Transforms to process such annotations
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-3952
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3952
>             Project: Groovy
>          Issue Type: New Feature
>          Components: ast builder
>    Affects Versions: 1.7.0
>         Environment: All
>            Reporter: Paul King
>            Priority: Major
>
> 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: 
> {code}
> @AstSource(CompilePhase.CONVERSION)
> def source = { println "compiled on: ${new Date()}" }
> {code}
> Or annotate a property within a closure (which is a 
> {{DeclarationExpression}}), like this: 
> {code}
> def result = new AstBuilder().build {
>            phase = CompilePhase.CONVERSION
>            @AstSource
>            source = { println "compiled on: ${new Date()}" }
>  }
> {code}
> A {{getAnnotations()}} method should probably be added to 
> {{DeclarationExpression}} to support this. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to