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

Nested ParameterizedTypes throws a ClassCastException #118

Closed
robert-bor opened this issue Jul 19, 2018 · 1 comment
Closed

Nested ParameterizedTypes throws a ClassCastException #118

robert-bor opened this issue Jul 19, 2018 · 1 comment

Comments

@robert-bor
Copy link
Contributor

When a property has nested ParameterizedType instances, a ClassCastException is thrown:

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

This happens for example with this construction:

public List<List<String>> names;

The reason for this happening is that the single generic in the list of generics in the ParameterizedType contains another ParameterizedType. This instance cannot be cast to a class, but must have its rawType extracted to see its Class.

robert-bor added a commit that referenced this issue Jul 19, 2018
When a type is a nested generic (eg, List<List<String>>) it threw a
ClassCastException, even if no mapping took place. Fixed by checking
the Type in ```AbstractBeanPropertyClass``` and calling for rawType
if it concerns a ParameterizedType.
robert-bor added a commit that referenced this issue Jul 19, 2018
#118 Nested ParameterizedTypes throws a ClassCastException
@marcus-talbot42
Copy link
Contributor

Fixed by #119

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

No branches or pull requests

2 participants