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

Parse error when using method call w/o parens in method-level annotation closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 1.8.4, 2.0-beta-1
    • parser-antlr2
    • None

    Description

      The following code:

      class Foo {
        @Bar({ sleep 1 })
        def baz() {}
      }
      

      gives this error:

      unexpected token: @ at line: 2, column: 3
      

      The error goes away when the argument in enclosed in parens:

      class Foo {
        @Bar({ sleep(1) })
        def baz() {}
      }
      

      Any other code changes (like adding explicit closure params) don't help. Class-level annotations don't have this problem. Anyone got an idea what's causing this?

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: