title: Managing several versions of serialized Java objects
body: <p>Lets say that I have a program that for some reason need to handle old versions of serialized objects.</p>
  
  <p>Eg: when deserializing, one of these versions may be encountered.</p>
  
  <pre><code>class Pet {
      private static final long serialVersionUID = 1L;
      int paws;
  }
  
  class Pet {
      private static final long serialVersionUID = 2L;
      long paws; // handle marsian centipedes
      boolean sharpTeeth;
  }
  </code></pre>
  
  <p>Lets assume that it's (logically) possible to convert an old object to a new object using some clever strategy to set nonexistant fields etc etc, but:</p>
  
  <p>How do I arrange my source code?  I would probably need both versions in the same source tree when writing a converter, but how do I handle that in , say, eclipse.</p>
  
  <p>Should I do deserialization in one class loader, and if that fails try using another class loader that uses an older version (and so on), or are there better ways?</p>
  
  <p>What's the best strategy? </p>