Is it considered bad to create a hierarchy of interfaces in Java?
I have designed my repository layer like this:
Repository, contains CRUD methodsJPARepository, potential methods that is only needed in JPASomeModelRepository, specific methods for the repository of that model.SomeModelJPARepository, extends JPARepository AND SomeModelRepository
Is this considered bad practice, and is it a strange organized hierarchy?
No, in fact it’s fairly common to create interface hierarchies, at least in libraries.
Take NavigableSet for instance, which has 4 layers of interfaces above it (SortedSet, Set, Collection, Iterable).
In this example, the diamond inheritance is a bit peculiar, but if necessary not a bad choice per se. But usually a tree hierarchy is much clearer and better. In this case I would consider making either: