Annotations on Interfaces?

前端 未结 10 2168
一生所求
一生所求 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:50

    I use findbugs extensively. I find the use of annotations to specify Nullity constraints very useful. Even if you dont actually use findbugs, it makes the intent of the code much clearer. Those annotations have their place on Interfaces as much as Classes. You could argue that it is kind of programming by contract ...

提交回复
热议问题