Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support serialization of scala sortedmap #162

Merged
merged 1 commit into from Nov 10, 2013
Merged

support serialization of scala sortedmap #162

merged 1 commit into from Nov 10, 2013

Conversation

koertkuipers
Copy link
Contributor

No description provided.

@koertkuipers
Copy link
Contributor Author

i would also like to add the requirement in KryoSpec:
orig.getClass.asInstanceOf[Class[Any]] must be_==(serdeser.getClass.asInstanceOf[Class[Any]])

it is currently true for all but one:
HashMap("good" -> 0.5, "bad" -> -1.0) starts life as a scala.collection.immutable.HashMap$HashTrieMap but comes out of the serialization and deserialization as a scala.collection.immutable.Map$Map2

johnynek added a commit that referenced this pull request Nov 10, 2013
support serialization of scala sortedmap
@johnynek johnynek merged commit 13148f1 into twitter:develop Nov 10, 2013
@johnynek
Copy link
Collaborator

I agree with the constraint that .getClass is an equivalence. I think the way to go here would be to make sure a TrieMap serializer is being used (and to create such a thing).

Also, we should really add more scala-check: randomly generate object graphs and make sure they (and their class identity) round-trips.

@koertkuipers
Copy link
Contributor Author

we already register HashMap.

i believe this line is causing the problem:
.forConcreteTraversableClass(Map[Any, Any]('a -> 'a, 'b -> 'b, 'c -> 'c, 'd
-> 'd, 'e -> 'e))

i debugged and that is the serializer/deserializer that gets used... which
should not happen. is it because of this:

scala> Map[Any, Any]('a -> 'a, 'b -> 'b, 'c -> 'c, 'd -> 'd).getClass
res17: java.lang.Class[_ <: scala.collection.immutable.Map[Any,Any]] =
class scala.collection.immutable.Map$Map4

scala> Map[Any, Any]('a -> 'a, 'b -> 'b, 'c -> 'c, 'd -> 'd, 'e ->
'e).getClass
res18: java.lang.Class[_ <: scala.collection.immutable.Map[Any,Any]] =
class scala.collection.immutable.HashMap$HashTrieMap

On Sun, Nov 10, 2013 at 5:45 PM, P. Oscar Boykin
notifications@github.comwrote:

I agree with the constraint that .getClass is an equivalence. I think the
way to go here would be to make sure a TrieMap serializer is being used
(and to create such a thing).

Also, we should really add more scala-check: randomly generate object
graphs and make sure they (and their class identity) round-trips.


Reply to this email directly or view it on GitHubhttps://github.com//pull/162#issuecomment-28163221
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants