-
Notifications
You must be signed in to change notification settings - Fork 166
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
Generic arrays results in ClassCastException, as the value is actually a Collection #492
Labels
Comments
michael-simons
added a commit
that referenced
this issue
Dec 10, 2018
The current implementation fails in some scenarios. Including the full type tools seems overkill and as it stands, it has only tested with JDK 9 and still uses Unsafe. Rewriting GenericTools would look pretty similar for our needs.
michael-simons
added a commit
that referenced
this issue
Dec 10, 2018
michael-simons
added a commit
that referenced
this issue
Dec 10, 2018
Take all declared fields of the hierarchy into consideration when building a FieldsInfo for concrete classes. Resolve type of generics fields in subtype.
michael-simons
added a commit
that referenced
this issue
Dec 10, 2018
This bug is probably unrelated.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
Take all declared fields of the hierarchy into consideration when building a FieldsInfo for concrete classes. Resolve type of generics fields in subtype.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
This bug is probably unrelated.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
Take all declared fields of the hierarchy into consideration when building a FieldsInfo for concrete classes. Resolve type of generics fields in subtype. This change also includes the tests from the original bug report.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
This bug is probably unrelated.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
The current implementation fails in some scenarios. Including the full type tools seems overkill and as it stands, it has only tested with JDK 9 and still uses Unsafe. Rewriting GenericTools would look pretty similar for our needs.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
Take all declared fields of the hierarchy into consideration when building a FieldsInfo for concrete classes. Resolve type of generics fields in subtype. This change also includes the tests from the original bug report.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
This bug is probably unrelated.
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
michael-simons
added a commit
that referenced
this issue
Dec 11, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
The loaded entity should have (depending on the specified generic type) a
Current Behavior
The loaded entity has an
As soon as you call the getter for getting the array, a ClassCastException is raised, as an ArrayList and UnmodifiableRandomAccessList are not the requested arrays
Possible Solution
Check the generic type and do not simply save a List. As a workaround: do not use arrays as generic types, but Lists.
Steps to Reproduce (for bugs)
Here is the link to the very basic example: https://github.com/Ph3n1x/neo4j-sdn-ogm-issue-report-template/tree/master/issue-492
Context
In my real world project, my base class is something like BaseField and I have many classes extending it, like
BytesField extends BaseField<byte[]>
,StringField extends BaseField<String>
and so on.When I try to access the stored value of my fields with some sort of arrays beeing the generic type T, I get the described ClassCastException
Your Environment
The text was updated successfully, but these errors were encountered: