You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/08/14 01:02:00 UTC

[jira] [Commented] (GROOVY-8249) @Newify on local variable declaration fails to resolve class expression

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

ASF GitHub Bot commented on GROOVY-8249:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/584

    GROOVY-8249: Newify local variable declaration fails to resolve class…

    … expression

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy 8249-Newify-VarDecl-ClassResolve

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/584.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #584
    
----
commit 2c11c1b72ff47e6c5ccb2134a7ea86da8cabc028
Author: John Wagenleitner <jw...@apache.org>
Date:   2017-08-14T00:15:00Z

    GROOVY-8249: Newify local variable declaration fails to resolve class expression

----


> @Newify on local variable declaration fails to resolve class expression
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-8249
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8249
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>
> If I use {{@Newify}} on a local variable declaration, I am getting an error that the class value is not resolvable.
> {code}
> @Newify(Date)
> def d = Date(1234L)
> {code}
> results in:
> {code}
> Script1.groovy: 1: Error during @Newify processing. Annotation parameter must be a class or list of classes but found an unresolvable reference to 'Date'.
>  @ line 1, column 9.
>    @Newify(Date)
>            ^
> {code}
> It looks like org.codehaus.groovy.classgen.VariableScopeVisitor.visitDeclarationExpression is missing a call to visitAnnotations.  Classes, fields, and methods all have this call.  When I add it, the VariableExpression resolves to a ClassExpression as expected.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)