Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8249

@Newify on local variable declaration fails to resolve class expression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.13
    • None
    • None

    Description

      If I use @Newify on a local variable declaration, I am getting an error that the class value is not resolvable.

      @Newify(Date)
      def d = Date(1234L)
      

      results in:

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

      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.

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: