Closed alexkvak closed 10 years ago
+1
We'd like to help, but this isn't enough information for us to be able to debug the issue. Could you provide us with a self-contained example? For example, we need to know what pickle
is as well as ApiState
.
Thanks!
By the way, we're just about ready to cut a 0.9.0 release, so if you can help us debug your issue, we can hopefully make sure that the fix gets into 0.9.0.
Also worth noting – unpickle
is now an extension method, just like pickle
, and thus it should be imported, typically via import scala.pickling._
. Make sure your imports are correct. If they are, could you please provide a complete example that fails?
case class ApiState(primaryDc: Int,
keys: Map[Int, Array[Byte]],
isAuth: Map[Int, Boolean],
connections: Map[Int, Iterable[ConnectionInfoState]],
mtProtos: Map[Int, MTProtoState]
)
case class ConnectionInfoState(id: Int, priority: Int, address: String, port: Int)
class MTProtoState(val dcId: Int, private[this] var apiStorage: TelegramApiState) extends AbsMTProtoState {
// cannot be private[this] because of picking
private var knownSalts: Array[KnownSaltInfo] = new Array[KnownSaltInfo](0)
// ...
}
case class KnownSaltInfo(validSince: Int, validUntil: Int, salt: Long)
If I use 0.8.0 everything works fine. I suspect this pull request https://github.com/scala/pickling/pull/196
I still need more info. Is there any way you can provide a complete example?
I need to know what the type of pickle
is, what pickle format you're using, etc. Ideally something self-contained enough to copy/paste into a REPL would help.
I use only standard pickle formats, no custom format is used
def unserialize(pickle: String): Unit = {
apiState = pickle.unpickle[ApiState]
// restore references to current ApiStorage
apiState.mtProtos.map(_._2.setApiStorage(this))
}
this is my unserialize function
I think I've got a fix for you, after merge (conditional on it passing the test suite), perhaps you could verify that this works for you? Either by checking out pickling and trying your use case in the REPL, locally building, or waiting until tomorrow's 0.9.0-SNAPSHOT to try again.
ok, I'll try tomorrow with fresh snapshot build. Thanks for quick problem resolution
everything works like a charm, thanks!
Great! Happy to hear!
Before the latest updates I had work code, and now I have the error
Library version is 0.9.0-SNAPSHOT
Please fix it ASAP