The JSR 308 proposal mentioned that there might be trust issues for annotations that can be subclassed outside a trusted framework. I contend that this is not a severe problem since it occurs with normal classes already.
To still address this issue, I decided to allow the final
modifier for annotations: An annotation that is final
cannot be subclassed, just like a final
class cannot be extended.
final @interface FinalAnnotation {
String value();
}
// ERROR: cannot inherit from final FinalAnnotation
@interface SubAnnotation extends FinalAnnotation {
int i();
}
Again, the change involved only half a dozen lines.