-
Notifications
You must be signed in to change notification settings - Fork 29
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
Serialization/deserialization revamped 🚀 #163
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
af1cca3
to
2329b8a
Compare
7f4c1fa
to
4c633bd
Compare
This was referenced Apr 29, 2024
0utplay
referenced
this pull request
in CloudNetService/CloudNet
May 16, 2024
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.electronwill.night-config:json](https://togithub.com/TheElectronWill/night-config) | `3.6.7` -> `3.7.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [com.electronwill.night-config:yaml](https://togithub.com/TheElectronWill/night-config) | `3.6.7` -> `3.7.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [com.electronwill.night-config:toml](https://togithub.com/TheElectronWill/night-config) | `3.6.7` -> `3.7.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>TheElectronWill/night-config (com.electronwill.night-config:json)</summary> ### [`v3.7.1`](https://togithub.com/TheElectronWill/night-config/releases/tag/v3.7.1): 3.7.1 Gradle fix ##### Fixes - Resolve a misconfiguration of the Gradle build, see [https://github.com/TheElectronWill/night-config/issues/173](https://togithub.com/TheElectronWill/night-config/issues/173) for more details - Fix a minor issue with the new options of `JsonParser` You should use v3.7.1 instead of v3.7.0. Please [read the release notes of v3.7.0](https://togithub.com/TheElectronWill/night-config/issues/173) :sparkles: to learn what has changed since v3.6.x. **Full Changelog**: TheElectronWill/night-config@v3.7.0...v3.7.1 ### [`v3.7.0`](https://togithub.com/TheElectronWill/night-config/releases/tag/v3.7.0): 3.7.0: NightConfig rejuvenated ✨ ##### Major changes - **`FileWatcher` now comes with out-of-the-box debouncing**, which improves the performance of autoreloading and autosaving configurations :zap:, see [https://github.com/TheElectronWill/night-config/pull/148](https://togithub.com/TheElectronWill/night-config/pull/148) - **`FileConfig` instances are now actually thread-safe** and work better with autoreload, which should prevent most of the corruption issues 🛡️, see [https://github.com/TheElectronWill/night-config/pull/152](https://togithub.com/TheElectronWill/night-config/pull/152) - **A new Serialization/Deserialization framework** is available in the `serde` package 🚀, see [https://github.com/TheElectronWill/night-config/pull/163](https://togithub.com/TheElectronWill/night-config/pull/163). Unlike the old `ObjectConverter`, the new `ObjectSerializer` and `ObjectDeserializer` are modular and extensible: you can register your own serializers and deserializers. Deserializers (config -> object) are chosen based on the generic type of the field to set and the type of the config value to deserialize. This allows for fine-grained deserialization. The old `ObjectConverter` still works but is now deprecated. The goal is to remove the old `conversion` package in version 4.0.0. ##### Enhancements - Allow multiple spec conditions to be checked by [@​vaperion](https://togithub.com/vaperion) in [https://github.com/TheElectronWill/night-config/pull/151](https://togithub.com/TheElectronWill/night-config/pull/151) (Note: this fix applies to the deprecated `conversion` package; the new `serde` package supports multiple `@SerdeAssert` conditions out of the box) - Support UTF-16 and UTF-8 BOM by [@​TheElectronWill](https://togithub.com/TheElectronWill) in TheElectronWill/night-config@68502b9 - In ConfigSpec and in the new `serde` Deserializer, automatically apply some "risky" conversions (e.g. long -> int) when it is not lossy, close [https://github.com/TheElectronWill/night-config/issues/119](https://togithub.com/TheElectronWill/night-config/issues/119) - Allow custom `Config` storage in `ConfigSpec`, by [@​PaintNinja](https://togithub.com/PaintNinja) in [https://github.com/TheElectronWill/night-config/pull/168](https://togithub.com/TheElectronWill/night-config/pull/168) - More unit tests, on Java 8, Java 11 and Java 17, by [@​TheElectronWill](https://togithub.com/TheElectronWill) ##### Bug fixes - toml: Fix squeezed Files by [@​Stein-N](https://togithub.com/Stein-N) in [https://github.com/TheElectronWill/night-config/pull/154](https://togithub.com/TheElectronWill/night-config/pull/154) - toml: Align List ending when in a "group" by [@​Stein-N](https://togithub.com/Stein-N) in [https://github.com/TheElectronWill/night-config/pull/160](https://togithub.com/TheElectronWill/night-config/pull/160) - toml: Allow header comments by [@​Stein-N](https://togithub.com/Stein-N) in [https://github.com/TheElectronWill/night-config/pull/162](https://togithub.com/TheElectronWill/night-config/pull/162) - json: Disallow trailing data (configurable) by [@​TheElectronWill](https://togithub.com/TheElectronWill), close [https://github.com/TheElectronWill/night-config/issues/167](https://togithub.com/TheElectronWill/night-config/issues/167) - Multiple bugs have been fixed in `ObjectConverter` by [@​TheElectronWill](https://togithub.com/TheElectronWill) in [https://github.com/TheElectronWill/night-config/pull/163](https://togithub.com/TheElectronWill/night-config/pull/163) ##### Compatibility Note NightConfig 3.7.0 is backward-compatible with previous releases, therefore I encourage you to upgrade your dependency on NightConfig in order to benefit from the new version. Binary-wise, the backward-compatibility has been checked with `japicmp`. Source-wise, there is one small incompatible change: `FileWatcher#addWatch` no longers throws an `IOException`, which can result in a compiler error `unreachable code` on the associated try/catch ([example in forge](https://togithub.com/MinecraftForge/MinecraftForge/blob/640c206117864085e3c25889bcabeaddd555e9fb/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java#L50-L55)). ##### New Contributors - [@​vaperion](https://togithub.com/vaperion) made their first contribution in [https://github.com/TheElectronWill/night-config/pull/151](https://togithub.com/TheElectronWill/night-config/pull/151) - [@​Stein-N](https://togithub.com/Stein-N) made their first contribution in [https://github.com/TheElectronWill/night-config/pull/154](https://togithub.com/TheElectronWill/night-config/pull/154) - [@​PaintNinja](https://togithub.com/PaintNinja) made their first contribution in [https://github.com/TheElectronWill/night-config/pull/168](https://togithub.com/TheElectronWill/night-config/pull/168) Thank you everyone! **Full Changelog**: TheElectronWill/night-config@v3.6.7...v3.7.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 6:00am" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/CloudNetService/CloudNet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibmlnaHRseSIsImxhYmVscyI6WyJ0OiBkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal: I want to replace the old
ObjectConverter
by a more flexible tool that allows for custom serialization/deserialization and is easier to test.Resolves #156, resolves #114, resolves #70, resolves #159, resolves #130, resolves #78, resolves #68 and possibly more in the future 😃