Marker interface pattern: Difference between revisions

Content deleted Content added
m Reverted edit by Gyanauce2006 (talk) to last version by Citation bot
Critique: Rewording critique
Line 27:
 
==Critique==
A majorOne problem with marker interfaces is that, since an interface defines a contract for implementing classes, and that contract is inherited by all subclasses., Thisa meansmarker thatcannot you cannotbe "unimplementunimplemented" a marker. In the example given, if you create aany subclass that you do not wantintended tofor serializeserialization (perhaps because it depends on transient state), you must resort to explicitly throwingthrow <code>NotSerializableException</code> exceptions (per <code>ObjectOutputStream</code> docs).
 
Another solution is for the language to support [[metadata]] directly: