This is my annotation:
@Target( { ElementType.METHOD } )
@Retention(RetentionPolicy.RUNTIME)
public @interface AuditUpdate
{
Class<?> value();
}
By this way it is ok:
@AuditUpdate(User.class)
void someMethod(){}
But by this way:
private static final Class<?> ENTITY_CLASS = User.class;
@AuditUpdate(ENTITY_CLASS)
void someMethod(){}
I have this compilation error:
The value for annotation attribute AuditUpdate.value must be a class literal
Why? What does that mean?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…