Why should we have the marker interfaces? For example, we have 'Serializable' interface. The object will be serialized only if the class is implementing serializable. Why they have implemented in such a way that all the objects are not serializable. Please give me an answer.
Joined: Sep 24, 2003
Your question is a little vague, so I'll make some assumptions. Why "should" we have them? Quite simply, we shouldn't. Why "do" we have them? Not all developers are of an expected level of competence, not even at Sun, not even JSR teams. When will they go away? Sun has implemented annotations in the 1.5 language specification. Although this does not solve them problem of existing APIs that have purported this atrocity, it is at least an acknowledgement (even if inadvertant) of the issue. Prior to 1.5, metadata is best specified using contractual specification in English, or simply, javadoc. e.g.