为什么@Target注解被@Retention(RetentionPolicy.RUNTIME)注解修饰
为什么@Target注解被@Retention(RetentionPolicy.RUNTIME)注解修饰,@Target被@Retention(RetentionPolicy.SOURCE)注解修饰不就够了吗,@Target不是编译时检查吗?
1 2 3 4 5 6 7 8 9 10 11 12 | @Documented @Retention (RetentionPolicy.RUNTIME) @Target (ElementType.ANNOTATION_TYPE) public @interface Target { /** * Returns an array of the kinds of elements an annotation interface * can be applied to. * @return an array of the kinds of elements an annotation interface * can be applied to */ ElementType[] value(); } |
4
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧