Could somebody pls explain the contract of marker interfaces in java?
For Ex: If Clonable
is a Marker Interface with no fields/methods, then where is t
Clonable
does not contain clone()
method, which is protected in java.lang.Object
.
More info available here
Citation From Josh Bloch's Effective Java:
"The Cloneable interface was intended as a mixin interface for objects to advertise that they permit cloning. Unfortunately it fails to serve this purpose ... This is a highly atypical use of interfaces and not one to be emulated ... In order for implementing the interface to have any effect on a class, it and all of its superclasses must obey a fairly complex, unenforceable and largely undocumented protocol"