-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
fix nested class property defaults loading #7718
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change seems good. Test looks solid. Are we sure that the old case, where the property was actually a String, still works here in case old maps actually relied on that?
|
Good input. I think it should work because the type should be string instead of class but I will add another object to the properties test map to validate it and to not break it in the future ;) |
|
I should have some free time this weekend. I'll give this a quick once over and a test, then report back any findings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the extra test! Approved again.
|
Had a moment to finally take a look. This seems pretty solid, as well as the tests. |
fix for #7717.
@BoBIsHere86 please play around with it as well whenever you have time.
The problem was with nested classes. My example was assigning a "project class" that has a class property itself to a tile but not specifying any of the values of the class property.
We then got an empty Json object in
loadMapPropertiesClassDefaultsand theclassMember.defaultValue.asString()then failed.The comment that class properties were already loaded before was wrong. It is true for flat class properties but it is not the case for nested classes (or at least not in that specific scenario).
We now handle this case with the
"class".equals(classMember.type)branch. I also enhanced the test and tried it in GWT and worked on my machine. I was also able to reproduce the issue of my project with this test initially.The new test object looks like this (Class is assigned to a project class called "testClassNested" which has another class property called "classClass"):

I also played around with it some more by adding more nesting and overriding certain values on different levels. For me it looked fine but would be great if someone else also plays around a little bit with it.
Iirc this method and the problem was introduced by me. Sorry for that! :(