-
Notifications
You must be signed in to change notification settings - Fork 642
SerializersModule overwriteWith throws when used twice #2820
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
Comments
Hm, this issue is quite nuanced because you have two different classes I have to ask, what is your use case here and what behavior from
|
Hey @sandwwraith, thanks for the context! We have an interface that is implemented by many concrete classes. Then, we have a common Example in pseudocode, assuming C and C1 have the same serial name:
While trying this, we ended up in a situation with two |
in SerializersModule.overwriteWith. Previous KClass should be removed from the map as well to avoid creating module with asymmetric mappings. Fixes #2820
Describe the bug
When
overwriteWith
is used twice, the second call throws an exception complaining that there are duplicated serializers. However, the duplicates should've been removed by the firstoverwriteWith
call.For the snippet below, the error message is:
To Reproduce
Also note that while this throws:
this doesn't:
However, we can't replace the first with the second, because they are not equivalent.
Expected behavior
I expect
overwriteWith
not to throw because of duplicated serializers. We should be able to do:And get a combined "union" module.
Environment
The text was updated successfully, but these errors were encountered: