1

Let's say I have the following interface:

interface Somethingable {

    @Foo
    void doSomething();
}

Now if I implement this interface, will the @Foo annotation be inherited on my implementation of doSomething() or do I have to write it again?

If it's inherited, is it a bad practice?

Yeti
  • 1,108
  • 19
  • 28
SystemGlitch
  • 2,150
  • 12
  • 27
  • It depends on the annotation, they have a retain property. – daniu Apr 20 '18 at 20:25
  • 1
    @daniu the [`RetrainPolicy`](https://docs.oracle.com/javase/9/docs/api/java/lang/annotation/RetentionPolicy.html) defines when the annotation is erased, not whether it is inherited. – Turing85 Apr 20 '18 at 20:26

0 Answers0