I have an anonymous class that subclasses TypeCreator [1], and it
somehow needs to be sent over the wire. Since it's an anonymous class,
it can't be serialized using standard Java functionality (Java
serializer requires that all necessary code is present on the remote
machine).
One of the approaches would be to convert reification code into a
bunch of POJO constructor calls. E.g. if we reify TypeRef(pre, sym,
args), then we emit TypeRefTypeCreator(reify(pre), reify(sym), args
map (reify(_))). Obvious downside is the amount of boilerplate that
needs to be written/generated.
Another way to tackle this challenge would be to somehow serialize the
bytecode itself. However I don't see a straightforward way of
obtaining bytecode for a method or a class.
I'm wondering what would be a good solution. @Akka guys, maybe you
know how to address the problem?
[1]
https://github.com/scalamacros/kepler/blob/f4693871f4aad1fdbdbb743feaed8a848a9e2dca/src/library/scala/reflect/base/TypeCreator.scala#L1