You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These might possibly be bugs, but determining how to solve them requires a design discussion.
Summary
The use case here is serializing a third party generic class with different contents: ThirdPartyBox.
As is show in the manual, the BoxSerializer in this test is capable of serializing any ThirdPartyBox and takes as its constructor arg the serializer for T.
Different from the examples for generics in the manual, we have to use contextual here, because we don't control ThirdPartyBox.
Registering bug
Unfortunately, registering another contextual serializer for the generic BoxSerializer fails, because SerializersModuleBuilders.registerSerializer() only looks at the toplevel type of generic types to determine if a serializer was already registered.
See #1406 for details. That PR contains only a test showing the issue.
Finding bug
Finding the serializer for a (generic) third party type by KType fails, because SerializersModule.serializerByKTypeImpl()
never tries getContextual() after constructSerializerForGivenTypeArgs() fails to find a serializer (and that will fail, because ThirdPartyBox is not annotated as @serializable, since it is a third party class).
This does work when doing the look up by Java type with serializerByJavaTypeImpl.serializerByJavaTypeImpl().
See #1397 for details. That PR contains a solution to be discussed, and tests to support it.
The text was updated successfully, but these errors were encountered:
These might possibly be bugs, but determining how to solve them requires a design discussion.
Summary
The use case here is serializing a third party generic class with different contents: ThirdPartyBox.
As is show in the manual, the BoxSerializer in this test is capable of serializing any ThirdPartyBox and takes as its constructor arg the serializer for T.
Different from the examples for generics in the manual, we have to use contextual here, because we don't control ThirdPartyBox.
Registering bug
Unfortunately, registering another contextual serializer for the generic BoxSerializer fails, because SerializersModuleBuilders.registerSerializer() only looks at the toplevel type of generic types to determine if a serializer was already registered.
See #1406 for details. That PR contains only a test showing the issue.
Finding bug
Finding the serializer for a (generic) third party type by KType fails, because
SerializersModule.serializerByKTypeImpl()
never tries
getContextual()
afterconstructSerializerForGivenTypeArgs()
fails to find a serializer (and that will fail, because ThirdPartyBox is not annotated as @serializable, since it is a third party class).This does work when doing the look up by Java type with
serializerByJavaTypeImpl.serializerByJavaTypeImpl()
.See #1397 for details. That PR contains a solution to be discussed, and tests to support it.
The text was updated successfully, but these errors were encountered: