I need to create an instances an instance of java.lang.Class that is otherwise identical to classOf[MyClass] but also has a SerialVersionUID, which MyClass does not have. MyClass is a Scala-2.10 class. One problem is that in Java SerialVersionUID is a static final while in Scala SerialVersionUID since Scala does not have statics.
If MyClass was a Java class I think I would be able do this using Javassist:
  val ctclass = javassist.ClassPool.getDefault().get("mypackagage.MyClass")
  val field = javassist.CtField.make(
      "private static final long serialVersionUID = 1L;",
      ctclass)
  ctclass.addField(field)
  val cls = ctclass.toClass()
However, this does not quiet work for Scala classes. I tried to use this in a ClassLoader for de-serialization.
there were no compile or run time errors during deserialization, but the deserialized object is incomplete, so there must be some more subtle problem. The gory details are described here. Presumably the problem comes from how static final fields are dealt with in Scala and the fact that Javassist only understands 
Java. How can I do it so it is 100% correct for Scala classes using either Javassist or any other means.