Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having multiple @Grab annotations not within a @Grapes annotation

 
David Karr
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an existing groovy script with 3 @Grab annotations before the first import, to get dependencies.

I've recently been reading "Making Java Groovy" (on Safari). In chapter 5, I saw the following statement:

"Because a member of a class can only have a single instance of a particular annotation, the @Grapes annotation is used to combine multiple @Grab annotations."

In the context of my script, which works just fine with multiple separate @Grab annotations, this is obviously false, but I imagine this statement likely used to be true. Does anyone know if that's the case?
 
Jochen Theodorou
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally Java does not support multiple annotations of the same type at one element. Extra for this JEP120 was issued (http://openjdk.java.net/jeps/120) -with target Java8. But the openjdk already supports it (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7151010).

Now in Groovy there are limits we are bound to by the JVM and thus we had to have @Grapes. Groovy already supports multiple annotations of the same type for a while, but if it works or not, depends on your JVM
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic