It says:
primitive
String
Class
an Enum
another Annotation
an array of any of the above
Only these types are legal to be as Annotation member, why can't a generic Enum be a member of Annotation?
For example :
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface Param {
Enum value();
}
This is not allowed. But Enum is a constant isn't it? As you are using @Param(XXX)
, filling in the Enum
, the @Param(XXX)
is decided (which means this is constant). Why is it only a specific enum allowed to be a member?
What I am trying to do is to make a Annotation that receives any enums:
// for example
@Param(value = AEnum.ABC)
@Param(value = BEnum.TTT)
@Param(value = CEnum.OOO)
I want all above to be legal.