Replace tagging interfaces with annotations


Why by now does the Java language replace some of its  "tagging interfaces" with annotations. Interfaces are meant to define the interface of an object. The interface does not specify any methods to be supported by classes that implement it. It is known as a "tagging interface"; it tags a class to be allowed to be serialized to a stream by *other classes.

It therefore should be regarded meta-data and not behaviour.  Meta-data is specified  in the Java language  using annotations. It would therefore be a better idea if interfaces such as are replaced with annotations: @Serializable. Of course due to Java's view on backwards compatibility, both need to be supported.

This article does not necessarily reflect the technical opinion of EDC4IT, but purely of the writer. If you want to discuss about this content, please use thecontact ussection of the site