You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/05/17 13:33:00 UTC

[jira] [Resolved] (GROOVY-3952) CLONE -Groovy Support for annotations on local variable declarations: Part II - Allow Local Transforms to process such annotations

     [ https://issues.apache.org/jira/browse/GROOVY-3952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles resolved GROOVY-3952.
---------------------------------
    Fix Version/s:     (was: 4.x)
       Resolution: Implemented

{{DeclarationExpression}} and indeed all expression types extend from {{AnnotatedNode}} now.  Annotations on local variable declarations are represented in the AST.

> 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)