Why am I getting an error \"Attribute value must be constant\". Isn\'t null constant???
@Target(ElementType.TYPE)
@Retention(RetentionPolicy
It would seem this is illegal, although the JLS is very fuzzy on this.
I wracked my memory to try and think of an existing annotation out there that had a Class attribute to an annotation, and remembered this one from the JAXB API:
@Retention(RUNTIME) @Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER})
public @interface XmlJavaTypeAdapter {
Class type() default DEFAULT.class;
static final class DEFAULT {}
}
You can see how they've had to define a dummy static class to hold the equivalent of a null.
Unpleasant.