groovy

Allow to omit square brackets in annotations when list has just one element (similar to Java)

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.4
  • Fix Version/s: 1.6-beta-1
  • Component/s: syntax
  • Labels:
    None
  • Number of attachments :
    0

Description

Let's say we have the following enum declaration (in Java):

@interface Person {
String[] friends();
}

In Java, curly braces may be omitted if a person has just one friend:

@Person(friends="Joe")
class Jane {}

In Groovy, this gives a compile error:
Annotation list attributes must use Groovy notation [el1, el2]

Of course @Person(friends=["Joe"]) still works, but it would be nice if Groovy also supported the abbreviated syntax.

Issue Links

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: