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

Field-local generics information not honored [DATACMNS-697] #1164

Closed
spring-projects-issues opened this issue May 15, 2015 · 3 comments
Closed

Field-local generics information not honored [DATACMNS-697] #1164

spring-projects-issues opened this issue May 15, 2015 · 3 comments
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 15, 2015

Max Alexejev opened DATACMNS-697 and commented

In my project, we have an entity called NormalizedProfile, which is a huge collection of generic ListField s. Each listField is a list of Value s plus some metadata. And Value is a (well) single "value" plus some metadata. In our case, atomic "value" is either primitive wrapper, Object or Enum, never a collection (in case it is relevant).

Value<T> gets its generic type from ListField<T> it is enclosed in. Nothing fancy.

In addition to standard java SpringDataMongo config, we customise MappingMongoConverter to stop save and use "_class" field. No polymorphic behaviour is needed in our case, so why not.

Problem is with Object- and Enum- generalized ListField s. After they are saved, they never read as a real object and returned as LHM instead. When I use java.util.List instead of our custom structure, everything works fine.

Please see attached minimal test - j.u.List<Education> testcase succeeds and ListField<Education> fails


Affects: 1.10 GA (Fowler)

Attachments:

Backported to: 1.10.1 (Fowler SR1), 1.9.3 (Evans SR3), 1.8.6 (Dijkstra SR6)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 15, 2015

Max Alexejev commented

Executable tests

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 16, 2015

Oliver Drotbohm commented

Thanks for finding this, Max! I've altered TypeDiscoverer to now also consider field-local generics information on parameterized types. Snapshots should be available in a few minutes. I ported the fix back into all currently maintained bugfix branches

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 16, 2015

Max Alexejev commented

Great job, Oliver! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.