标签:mystra java annotation attribute value 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() { } }数组无法进行常量化,只能使用字符常量。
Java - Error: Attribute value must be constant
标签:mystra java annotation attribute value constant
原文地址:http://blog.csdn.net/caroline_wendy/article/details/43614547