groovy
  1. groovy
  2. GROOVY-4839

Omit parentheses in annotation closure

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: parser-antlr
    • Labels:
      None
    • Number of attachments :
      0

      Description

      It would be great to have a possibility to omit parentheses in closure annotations like this:

      @Require({it > 2})
      def myMethod() {
        ...
      }
      

      and after change:

      @Require {it > 2}
      def myMethod() {
        ...
      }
      

        Activity

        Hide
        Guillaume Laforge added a comment -

        This would be nice, of course, and we already thought about it, but the problem is that we'd like Groovy to support annotations on arbitrary expressions, and that would mean that we could allow annotations on literal closures as well. So we may have a clash here as this would be ambiguous if we supported that feature.

        I'm not closing the issue as "won't fix" for now, as we haven't fully studied the impact of such a change, in the light of our wish to support annotations on any expressions, including closures.

        Show
        Guillaume Laforge added a comment - This would be nice, of course, and we already thought about it, but the problem is that we'd like Groovy to support annotations on arbitrary expressions, and that would mean that we could allow annotations on literal closures as well. So we may have a clash here as this would be ambiguous if we supported that feature. I'm not closing the issue as "won't fix" for now, as we haven't fully studied the impact of such a change, in the light of our wish to support annotations on any expressions, including closures.

          People

          • Assignee:
            Unassigned
            Reporter:
            Noname
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: