groovy
  1. groovy
  2. GROOVY-4290

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.8.4, 2.0-beta-1
    • Component/s: parser-antlr
    • Labels:
      None
    • Number of attachments :
      0

      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?

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Peter Niederwieser
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: