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 2022/07/05 17:00:00 UTC

[jira] [Commented] (GROOVY-7677) AbstractASTTransformation member-value methods should traverse compile-time constants

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

Eric Milles commented on GROOVY-7677:
-------------------------------------

There is some inlining done by the compiler to resolve some of these references.  Do you have an example that is still a problem?

> AbstractASTTransformation member-value methods should traverse compile-time constants
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7677
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7677
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>    Affects Versions: 2.4.5
>            Reporter: Christopher Smith
>            Priority: Major
>
> As described [in Cédric's article on parameterized transformations|https://melix.github.io/ast-workshop/exercise4-hints.html], the value of an annotation member during a transformation can be one of several types of expression. The {{AbstractASTTransformation}} class provides a number of methods that "get member values", but only if those values are provided as an *immediate* {{ConstantExpression}}.
> Using, for example, a {{public static final String}} as an annotation value is perfectly legitimate, and the current implementation simply treats the value as if it were not present. While it would be some work, I suggest that the behavior of these methods should be enhanced to both traverse property/variable expressions and support retrieval of annotation default values.
> If this is agreeable and there's no identifiable technical reason why this isn't feasible, then I'll attempt to implement at least part of the behavior as part of [my blog series|https://blog.chrylis.com/2015/11/13/introducing-gjt/] and would like to explore merging it into the main distribution.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)