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

Fix for referencing bean format using incorrect class name with JodaConvert interfaces #204

Merged

Conversation

wjnicholson
Copy link
Collaborator

@wjnicholson wjnicholson commented May 8, 2019

Currently if one serializes an immutable bean which holds under an Object reference something implementing a JodaConvert interface with multiple implementations and the type is required to be serialized then the referencing converter chooses to serialize the first concrete implementation class name it encounters, rather than that of the interface itself.

Added a test case for it and deleted some useless code (we don't care about serializing class names for null values; also serializing classes as values is easy, just write the class name!)

Copy link
Member

@jodastephen jodastephen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with other serializers? I'm not certain that they output the interface name.


final class First implements JodaConvertInterface {

static final First instance = new First();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance -> INSTANCE


final class Second implements JodaConvertInterface {

static final Second instance = new Second();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance -> INSTANCE

@wjnicholson
Copy link
Collaborator Author

wjnicholson commented May 8, 2019

What happens with other serializers? I'm not certain that they output the interface name.

I'll add the same test for the other serializers, but in the instance that you cannot determine the type from the bean (as in the test they're a map value of type Object) then the interface name is serialized for the binary, xml, and json writers.

@jodastephen jodastephen merged commit 2068e19 into JodaOrg:master May 8, 2019
@jodastephen
Copy link
Member

Thanks

@wjnicholson wjnicholson deleted the topic/fix-joda-convert-interfaces branch May 9, 2019 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants