Fix and verify property transience #558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #R37. Corrupted configs are automatically patched back into a valid state.
The issue was that the
generatorfield was incorrectly not seen as transient, and therefore serialized to users' config files. However, a lambda cannot be (de)serialized! Therefore, when loading the config, an exception occurred.Understanding how the serializer determines what to serialize was very tough. It's so tough, and so unclear (imo) that I decided to open an issue with JetBrains requesting that they either make it work as I expect it to, or better document how it works currently.
Until then, I have added a large number of tests that help verifying that serialization is successful. Previously, #551 introduced the "magical"
mutatefunction to automatically mutate aStateand see if this affects serialization. I have extended this idea withStateReflection, which is a general library for inspectingStateclasses generically (i.e. without knowing which state class it is) so that I can write automatically generated tests for serialization. Of course, those automated tests can also fail, so I also added a few manual tests that cover the most egregious cases.Finally, this PR also
lowercasegiving the no-longer-requiredLocaleparameter, andCapitalizationModeand better tests them.