While I think there should be a general rule for inheriting annotations or not, I'm specifically interested in making FindBugs recognize my rules, so this question is FindBugs specific.
AFAIK, JavaDoc comments are taken from the interface and are ignored at the implementation. Does this concept also apply to annotations like @Nonnull
(or @NotNull
)?
Given the @Override
annotation, it is at least possible to add additional annotations which are not present at the interface.
What will happen in the following cases? Will FindBugs recognize all of them? Which one is the preferred one regarding clean code?
- Interface
@Nonnull
, Implementation@Override
- Interface
@Nonnull
, Implementation@Override
,@Nonnull
- Interface has no annotation, Implementation
@Override,
@Nonnull`