Inheriting class annotations

Class annotations can not be inherited by subclasses.

What you can do is "force" the subclass to use the annotation at compile time:

https://community.oracle.com/docs/DOC-983563


If you define your annotations classes yourself, then you can use @Inherited meta annotation:

Indicates that an annotation type is automatically inherited. If an Inherited meta-annotation is present on an annotation type declaration, and the user queries the annotation type on a class declaration, and the class declaration has no annotation for this type, then the class's superclass will automatically be queried for the annotation type.