Java_注解_异常_01_ElementType cannot be resolved to a variable
2017-09-20 15:22
405 查看
一、异常现象:
自定义注解时,@Retention和@Target都能导入进来,但是却报下列错误:
RetentionPolicy cannot be resolved to a variable ElementType cannot be resolved to a variable
二、异常原因:
没有引入这两个类三、解决方法:
手动引入RetentionPolicy和ElementType这两个类方法一:
import java.lang.annotation.*方法二:
import java.lang.annotation.RetentionPolicy;import java.lang.annotation.ElementType;
相关文章推荐
- sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class异常解决方法
- RetentionPolicy/ ElementType cannot be resolved to a variable
- sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class异常解决方法
- r cannot be resolved to a variable 问题解决 / R.java文件没有自动生成
- [java][43]XXXcannot be resolved to a type
- 利用泛型抽取Dao层,加事务注解问题(java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType)
- gen文件夹下没有R.java(R cannot be resolved to a variable)+运行时找不到xx.apk文件
- cannot be resolved to a type (Java)
- *** cannot be resolved to a type异常
- java eclipse 出现 xxx cannot be resolved to a type 错误解决方法
- r cannot be resolved to a variable 问题解决 / r.java文件没有自动生成
- javax.servlet.jsp.pagecontext cannot be resolved to a type异常记录
- The type java.lang.reflect.Type cannot be resolved异常的处理
- r cannot be resolved to a variable 问题解决 / r.java文件没有自动生成 分类: Android安装及配置 2014-06-22 18:03 141人阅读 评论(0) 收藏
- Android开发时,写MainActivity.java时出现TextView cannot be resolved to a type
- sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
- 【明哥报错簿】之【 "javax.servlet.http.HttpServlet" was not found on the Java Build Path || HttpServletRequest/HttpServletResponse cannot be resolved to a type】
- r cannot be resolved to a variable 问题解决 / r.java文件没有自动生成
- java 导入的项目很多都报javax.servlet.jsp cannot be resolved to a type的错误,不是导包问题
- java中”XX cannot be resolved to a type”的报错信息