Example in 8misc.pdf re. containing annotations

Jesper Steen Møller jesper at selskabet.org
Tue Oct 1 13:05:08 PDT 2013


Hi List

The example of declared targets (Section 9.6) has an example, which I think is in error:
An annotation whose type declaration indicates a target of java.lang.annotation.ElementType.TYPE can appear in at least as many locations as an annotation whose type declaration indicates a target of java.lang.annotation.ElementType.ANNOTATION_TYPE. For example, given the following declarations of repeatable and containing annotation types:

       @Target(ElementType.TYPE)
       @ContainedBy(FooContainer.class)
       @interface Foo {}
       @Target(ElementType.ANNOTATION_TYPE)
       @ContainerFor(Foo.class)
       @Interface FooContainer {
           Foo[] value();
       }
Is this from an earlier version, so that @ContainedBy should be @Repeatable, and @ContainerFor should be omitted?

Kind regards, 
Jesper


More information about the enhanced-metadata-spec-discuss mailing list