Replace tagging interfaces with annotations: @Serializable

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 java.io.Serializable 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 java.io.Serializable are replaced with annotations: @Serializable. Of course due to Java’s view on backwards compatibility, both shall be supported.

  • Share/Bookmark

About this entry