@Mapping should be an inherited annotation
slu-it opened this issue · comments
Currently the @Mapping
and @Mappings
annotations are not inherited in case the annotated class is subclasses.
Example:
@Mapping(tag = "foo")
public interface FooFragment extens PageFragment {
// can only be initialized for <foo> elements
}
public interface SpecialFooFragment extens FooFragment {
// can be initialized for every element
}
The behavior should be changed in a way that inherits the annotation if it is not overridden by the subclass.
Note: Java does not allow for annotation inheritance from / on interfaces.
There is a fundamental problem:
Since we are based on interfaces there is an inherent multiple inheritance problem when it comes to checking which @mapping annotations to use. We could traverse the interface's parent interfaces as long as we wanted to find the first @mapping annotations and use them. But if we do this there is no way of defining a PageFragment subclass which does explicitly NOT use @mapping.