RetentionPolicy/ ElementType cannot be resolved to a variable

自定义注解,在定义@Target(value=ElementType.FIELD)和@Retention (value=RetentionPolicy.RUNTIME)类时报错:

RetentionPolicy/ ElementType cannot be resolved to a variable

解决办法(手动导入类路径):

import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;

来源:https://blog.csdn.net/hanchao5272/article/details/79277930


59 Clicks !

发表评论

电子邮件地址不会被公开。