/**
* Annotations are to be discarded by the compiler.
*/
SOURCE
注解在源码时有效,将会被编译器抛弃。
/**
* Annotations are to be recorded in the class file by the compiler
* but need not be retained by the VM at run time. This is the default
* behavior.
*/
CLASS
注解在编译时有效,但在运行时没有保留。这也是默认行为。
/**
* Annotations are to be recorded in the class file by the compiler and
* retained by the VM at run time, so they may be read reflectively.
*
* @see java.lang.reflect.AnnotatedElement
*/
RUNTIME
Retention注解与RetentionPolicy配合使用,用于标注一个注解在什么阶段有效。如果一个注解没有使用@Retention则默认使用RetentionPolicy.CLASS策略/** * Annotations are to be discarded by the compiler. */SOURCE注解在源码时有效,将会被编译器抛弃。/** * Annotations a...