Annotations on Interfaces?

前端 未结 10 2160
一生所求
一生所求 2020-12-08 21:52

I can\'t figure out a use case for being able to annotate interfaces in Java.

Maybe someone could give me an example?

10条回答
  •  死守一世寂寞
    2020-12-08 22:39

    I mark my interfaces with @Immutable to clearly indicate to developers of subclasses which Mutability contract a class implementing the interface should have. As gehel puts it, programming by contract.

提交回复
热议问题