This repository was archived by the owner on Feb 20, 2019. It is now read-only.
Unpickle java.lang.Class fails with IllegalAccessException #347
Open
Description
I've created test that illustrates issue.
In short
val clazz: Class[Int] = classOf[Int]
val pickle = clazz.pickle
val deserializedJsonPickle: JSONPickle = JSONPickle(pickle.value)
val deserializedClass: Class[Int] = deserializedJsonPickle.unpickle[Class[Int]] // fails on this line
It fails like:
[info] - must unpickle java.lang.Class from JSON *** FAILED ***
[info] java.lang.IllegalAccessException: java.lang.Class
[info] at sun.misc.Unsafe.allocateInstance(Native Method)
If this is expected behaviour then just let me know.
Why do I want pickle Class object? Because I've been thinking about serializing akka.actor.Props (which has java.lang.Class of actor) in order to recreate actor at some point in the future at different node (kind of moving computation to data thingy)