Java - Error: Attribute value must be constant
来源:互联网 发布:qs网络语是什么意思 编辑:程序博客网 时间:2024/05/29 09:51
Error: Attribute value must be constant
本文地址:http://blog.csdn.net/caroline_wendy
Attribute value must be constant. 属性的值必须要是Constant.
如,在Annotation的接口中的值,但是字符串数组不能指定为Constant,Java中static final。
只能把纯字符设置为Constant,因此只能按如下使用:
public @interface SampleAnnotation { String[] sampleValues(); } public class Values { public static final String v1 = "A"; public static final String v2 = "B"; @SampleAnnotation(sampleValues = { v1, v2 }) public void foo() { } }数组无法进行常量化,只能使用字符常量。
参考: http://stackoverflow.com/questions/2065937/how-to-supply-value-to-an-annotation-from-a-constant-java
1 0
- Java - Error: Attribute value must be constant
- attribute value must be constant
- ButterKnife:Attribute value must be constant
- 【日常踩坑】ButterKnife:Attribute value must be constant
- ButtonKnife在library报“Attribute value must be constant”
- ButtonKnife在library中引用“Attribute value must be constant”报错解决
- Error: This attribute must be localized. 解决方法
- Error: This attribute must be localized. 解决方法
- error:assign attribute must be unsafeunretained
- Error: This attribute must be localized. 解决方法
- [异常整理]java.lang.IllegalArgumentException: Attribute value must not be null
- Error处理:Java switch case 报错:case expressions must be constant expressions
- R.java case expressions must be constant expressions
- java switch 异常 case expressions must be constant expressions
- expressions must be constant expressions
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Hibernate中的懒加载原理分析
- 面试题
- 哲学家就餐-条件变量
- Uva-815 - Flooded!-AC
- 解决Magento1.9 安装后前台首页的链接必须加上index.php才能访问
- Java - Error: Attribute value must be constant
- NiftyDialogEffects(各种动画的dialog)
- Android NDK开发篇(一):新版NDK环境搭建(免Cygwin,超级快)
- OPENWRT设置之命令行下简单配置有线和无线
- Android使用NDK调用C语言写的SO进行加密
- hdu 5171 GTY's birthday gift (BestCoder Round #29)
- tibco学习资源
- linux 下文件I/O编程 (open、read、write、lseek、close)
- uva 10169