Search code examples
javainterfaceannotationsdesign-decisions

If we have @Override why is there not @Implementation or @Implements`?


I'm curious as to why we have the @Overrides annotation, but there is not a similar idiom for interfaces (such as @Implements or @Implementation). It seems like it'd be a useful feature, as you could require the interface you are implementing to be a value of the annotation.

Was this a conscious decision or just an overlooked one?

I found this question, but it doesn't seem to discuss why there wasn't a separate annotation created.


Solution

  • In most cases you don't need such an annotation, because if you don't implement the interface you will receive a compile-time error. The only case is if the class is abstract. There it can be useful. But then again you have the @Override, so a new annotation is probably useless.