This content has been marked as final. Show 2 replies
Could you try to rephrase your question a bit, I'm not entirely sure I understand what you ask.
Marker interfaces have always been kind of strange beasts and not everyone agrees that they are a good idea.
With the introduction of annotations their importance has been reduced further as annotations are often a better fit for a given goal than marker interfaces.
And from what I understand about your questions annotations also support the scenario you talk about: marking a base class while not forcing derived classes to carry the same mark works just fine with annotations.
Additionally annotations make the intention of simply providing some meta-data even clearer and have the added benefit of allowing additional data to be provided.
The only advantage that marker interfaces still have is type safety. If I have a method that handles some object and serializes it, then I can simply require a Serializable object, which wouldn't work if that would be indicated by an annotation.
Rather than Classes extending a interface would it not be good feature if Marker interface could follow the Dependency Injection path.Why would it be a good feature?
For ex : if a user wants a class to behave a marker implementation it could be added as part of the constructor restricting the usage to the sudden class rather.This would rather provide a control on whether a subclass requires to be marked as well.Is that important?