我有枚举:
public enum Scope {
USER, GLOBAL;
public static final Scope[] TRANSIENT = {};
public static final Scope[] USER_OVER_GLOBAL = {GLOBAL, USER};
public static final Scope[] GLOBAL_OVER_USER = {USER, GLOBAL};
}
和注释:
public @interface Config {
public Scope[] load() default Scope.GLOBAL_OVER_USER; // Can't use this defval
public Scope[] save() default Scope.USER;
}
为什么我不能使用静态数组作为注解属性的默认值?我的 NetBeans 7.3 Beta 告诉我需要Scope
但已找到Scope[]
- 正如您所看到的那样,这不是真的。是否存在与 NB 或 Java 7 相关的混淆?