-
-
Notifications
You must be signed in to change notification settings - Fork 366
javers.compare throw class cast exception #1030
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
Comments
Interesting bug, thanks for the good report |
This case can't be solved in Javers, you can't compare String to List. |
fixed in 5.13.2 |
I think it will be very useful to check types of the items in the list. In this case I do not compare a List with a String. I compare two lists containing fields. I assume I should be quite easy to first check it the item contain the same type. If not there is a difference between those items. But even if you want to check between the same property names, a simple check on property type would fix this issue. A the moment it is a very tricky one. Just throwing an exception will only occur at runtime. And if a developer is not aware of this, the issue might be first recognized on production. A check the other way around does not trigger this exception. About the solution is elegant or not, is a matter of taste and not very relevant in this case. In my opinion each child class should uses the property names they that fit, and should not depend on the fact if the name is already used in another class or not. |
This issue is solved by simple type checking |
Clear description of my expectations versus reality
No exception should be thrown
Steps To Reproduce
I have a **runnable test case ** which isolates the bug and allows Javers Core Team to easily reproduce it. I have pushed this test case to my fork of this repository:
https://github.com/mhelvo/javers/blob/master/javers-core/src/test/java/org/javers/core/cases/ListWithChildClassesTest.java
Javers' Version
5.**
Additional context
...
The text was updated successfully, but these errors were encountered: