Some Restrictions
There are a number of restrictions that apply to annotation declarations. First, no annotation
can inherit another. Second, all methods declared by an annotation must be without parameters.
Furthermore, they must return one of the following:
· A primitive type, such as int or double
· An object of type String or Class
· An enum type
· Another annotation type
· An array of one of the preceding types
Annotations cannot be generic. In other words, they cannot take type parameters. (Generics
are described in Chapter 14.) Finally, annotation methods cannot specify a throws clause.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home