Understand when marker interfaces still make sense in Java and why annotations now cover many metadata uses more cleanly.
Marker interface: An interface with no methods that signals some semantic property through type membership alone.
Classic Java examples include Serializable and Cloneable.
Marker interfaces are useful when the signal should participate in the type system. A method can require a marker interface at compile time, and tools or frameworks can inspect type membership directly.
Marker interfaces cannot:
That is why many modern metadata use cases are better expressed with annotations.
Use a marker interface when type membership itself is the important contract. Use annotations when metadata needs more expressiveness.