I would like to know if it is possible to rewrite this function using Scala-2.10 reflection instead of Javassist:
def adaptClass(name1: String, name2: String) : Class[_] = {
import javassist._
val cls = ClassPool.getDefault().getAndRename(name1, name2)
val field = CtField.make("private static final long serialVersionUID = 1L;", cls))
cls.addField(field, cls))
cls.toClass()
}
I am most interested in the part that adds a SerialVersionUID field to the new class,
since that part of the above code does not actually work correctly for Scala classes.
The key point is that we the field being added is static final
.