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 2023/01/10 16:13:00 UTC

[jira] [Updated] (GROOVY-10900) Local variable annotations not available through accessed variable

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

Eric Milles updated GROOVY-10900:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@Deprecated def object = null
@Deprecated def (int i, Number n) = list
{code}

Any {{VariableExpression}} reference to "object", "i" or "n" later in the block cannot look back through accessedVariable and determine the annotations of the declaration.  That is, the {{DeclarationExpression}} instances carry the annotations and the 3 {{VariableExpression}} instances within do not have annotations.

By contrast, a variable reference to a {{FieldNode}} or {{Parameter}} can get back to the field or param and inspect the annotations.

Should the annotations be moved to the variable expression(s)?

  was:
Consider the following:
{code:groovy}
@Deprecated def object = null
@Deprecated def (int i, Number n) = list
{code}

Any {{VariableExpression}} reference to "object", "i" or "n" later in the block cannot look back through accessedVariable and determine the annotations of the declaration.  That is, the {{DeclarationExpression}} instances carry the annotations and the 3 {{VariableExpression}} instances within do not have annotations.

Should the annotations be moved to the variable expression(s)?


> Local variable annotations not available through accessed variable
> ------------------------------------------------------------------
>
>                 Key: GROOVY-10900
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10900
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Minor
>
> Consider the following:
> {code:groovy}
> @Deprecated def object = null
> @Deprecated def (int i, Number n) = list
> {code}
> Any {{VariableExpression}} reference to "object", "i" or "n" later in the block cannot look back through accessedVariable and determine the annotations of the declaration.  That is, the {{DeclarationExpression}} instances carry the annotations and the 3 {{VariableExpression}} instances within do not have annotations.
> By contrast, a variable reference to a {{FieldNode}} or {{Parameter}} can get back to the field or param and inspect the annotations.
> Should the annotations be moved to the variable expression(s)?



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