Handle iterables #13

Closed
avibryant opened this Issue Jan 3, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@avibryant
Collaborator

avibryant commented Jan 3, 2013

The specific instance I ran into was MapLike.DefaultValuesIterable, but I bet there are other similar classes that also don't serialize.

@johnynek

This comment has been minimized.

Show comment Hide comment
@johnynek

johnynek Jan 7, 2013

Collaborator

I added an Iterable serializer, but the problem is on the deserialization side you are going to get something acts as if it was just: Iterable(1,2,3), which may not be the type that some other code is exception.

I tried to add a direct serializer, but I had a bit of trouble getting the Class object associated with this type due to the f-bounded polymorphism. Reflection may have to come into play. Since it is java.io.Serializable, the best approach is probably to use Kryo's JavaSerializer for this type (especially since it probably isn't too common).

That, or you can manually convert that type into a List or something (using .toList) before you pass it along.

If you are able to create a class object for this type, just do:

.javaForClass(ClassManifest.fromClass(/* class object here */))

(using the RichKryo enrichment).

Collaborator

johnynek commented Jan 7, 2013

I added an Iterable serializer, but the problem is on the deserialization side you are going to get something acts as if it was just: Iterable(1,2,3), which may not be the type that some other code is exception.

I tried to add a direct serializer, but I had a bit of trouble getting the Class object associated with this type due to the f-bounded polymorphism. Reflection may have to come into play. Since it is java.io.Serializable, the best approach is probably to use Kryo's JavaSerializer for this type (especially since it probably isn't too common).

That, or you can manually convert that type into a List or something (using .toList) before you pass it along.

If you are able to create a class object for this type, just do:

.javaForClass(ClassManifest.fromClass(/* class object here */))

(using the RichKryo enrichment).

@johnynek

This comment has been minimized.

Show comment Hide comment
@johnynek

johnynek Jun 26, 2013

Collaborator

Avi, could you make a test case that fails with the specific one you wanted? We can just use reflection with specific field tricks to do these corner cases.

That or close the issue and let's forget about it.

Collaborator

johnynek commented Jun 26, 2013

Avi, could you make a test case that fails with the specific one you wanted? We can just use reflection with specific field tricks to do these corner cases.

That or close the issue and let's forget about it.

@sritchie

This comment has been minimized.

Show comment Hide comment
@sritchie

sritchie Aug 9, 2013

Collaborator

Closing; we can revive this bad dog if it comes up again.

Collaborator

sritchie commented Aug 9, 2013

Closing; we can revive this bad dog if it comes up again.

@sritchie sritchie closed this Aug 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment