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

ClassNameIdResolver doesn't handle resolve Collections$SingletonMap & Collections$SingletonSet #1823

Merged
merged 2 commits into from
Dec 4, 2017

Conversation

peterjurkovic
Copy link
Contributor

The current implementation of ClassNameIdResolver doesn't handle java.util.Collections$SingletonMap neither java.util.Collections$SingletonSet due to this deserialization of these classes fails with an error Cannot construct instance of java.util.Collections$SingletonMap (no Creators, like default construct, exist)

This is due to that an object is serialized as:

{"@class":"java.util.Collections$SingletonMap","x":"Y"}

This pull request added support for

  • java.util.Collections$SingletonSet
  • java.util.Collections$SingletonMap

java.util.Collections$SingletonList was already supported. Also not quite sure why was used protected final modifier protected final String _idFrom(..) I would keep an option to override this method otherwise is quite difficult fix/adapt a behavior of this class.

@peterjurkovic peterjurkovic changed the title ClassNameIdResolver fails for Collections$SingletonMap & Collections$SingletonSet ClassNameIdResolver doesn't handle resolve Collections$SingletonMap & Collections$SingletonSet Nov 15, 2017
@cowtowncoder cowtowncoder merged commit 8d6c35d into FasterXML:2.9 Dec 4, 2017
@cowtowncoder cowtowncoder modified the milestones: 2.9,0.pr4, 2.9.3 Dec 4, 2017
cowtowncoder added a commit that referenced this pull request Dec 4, 2017
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.

2 participants