慕先生5091689
2019-10-23 14:18
@Documented @Retention(RetentionPolicy.RUNTIME) @Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) public @interface Deprecated { }
@Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE) public @interface Override { }
@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) @Retention(RetentionPolicy.SOURCE) public @interface SuppressWarnings {
是呀 看法一致, @Deprecated是运行时
/** * Annotations are to be discarded by the compiler. * 编译完成就被丢弃了。编译完成的java 变成.class */ 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 文件当中 在运行时不保留在jvm 中。也就是程序运行的时候找不到他。 */ 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. * 记录在class 文件当中,程序运行时你还可以用 * @see java.lang.reflect.AnnotatedElement */ RUNTIME
全面解析Java注解
126934 学习 · 102 问题
相似问题