File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes Having multiple @Grab annotations not within a @Grapes annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Having multiple @Grab annotations not within a @Grapes annotation" Watch "Having multiple @Grab annotations not within a @Grapes annotation" New topic
Author

Having multiple @Grab annotations not within a @Grapes annotation

David Karr
Greenhorn

Joined: Jan 06, 2008
Posts: 12
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

Joined: Dec 13, 2006
Posts: 4
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having multiple @Grab annotations not within a @Grapes annotation
 
Similar Threads
Unresolved dependencies in example scripts
How do I install a 3rd party module in Groovy?
Groovy grapes for java programmers?
Question on the Groovy book
Groovy, a new scripting language, yeeeha, so what ?