title: Java: Should serializable inner & anonymous classes have SerialVersionUID?
body: <p>Although I'm not currently planning to serialize anything, I give all serializable outer classes, as well as static nested classes a <code>SerialVersionUID</code>, because that is the proper way to do it.</p>
  
  <p>However, I've read <a href="http://docs.oracle.com/javase/7/docs/platform/serialization/spec/serial-arch.html" rel="nofollow">here</a> that</p>
  
  <blockquote>
    <p>Serialization of inner classes (i.e., nested classes that are not static member classes), including local and anonymous classes, is strongly discouraged for several reasons. ...</p>
  </blockquote>
  
  <p>So my question is:</p>
  
  <p>Should I give inner and anonymous classes a <code>SerialVersionUID</code> each, or should I add a <code>@SuppressWarnings("serial")</code> to those?</p>
  
  <p>Is one way more proper than the other?</p>
  
  <p>I will in any case make references to such classes transient, because I don't want them to be serialized.</p>