CHAPTER 6
ENUMS AND ANNOTATIONS
186
takes a single parameter, which is the class object of a
containing annotation type
,
whose sole parameter is an array of the annotation type [JLS, 9.6.3]. Here’s how
the annotation declarations look if we take this approach with our
ExceptionTest
annotation. Note that the containing annotation type must be annotated with an
appropriate retention policy and target, or the declarations won’t compile:
Do'stlaringiz bilan baham: