Constrain targets for @Filter declaration

For clarity, add @Target({}) to definition of @Filter, constraining it
to complex annotation composition only; i.e. it cannot be placed on
any element, only within annotations, e.g.

    @ComponentScan(includeFilters=@Filter(...))

is legal, while

    @Filter
    public class MyType { }

is not.

Also, widen @Retention from SOURCE to RUNTIME, even though it is not
technically necessary, as all parsing of @Filter annotations happens via
ASM, i.e. at the source level.  This change is made primarily for
consistency (@ComponentScan's Retention is RUNTIME) and in avoidance of
potential confusion or surprise on the part of those casually browsing
the code.
This commit is contained in:
Chris Beams 2011-12-06 12:17:54 +00:00
parent c2c224958d
commit df7bda5637
1 changed files with 2 additions and 1 deletions

View File

@ -128,7 +128,8 @@ public @interface ComponentScan {
* Declares the type filter to be used as an {@linkplain ComponentScan#includeFilters()
* include filter} or {@linkplain ComponentScan#includeFilters() exclude filter}.
*/
@Retention(RetentionPolicy.SOURCE)
@Retention(RetentionPolicy.RUNTIME)
@Target({})
@interface Filter {
/**
* The type of filter to use.