Use more pattern matching in Marshalling class#296
Merged
hypfvieh merged 1 commit intohypfvieh:masterfrom Feb 18, 2026
Merged
Conversation
While this is mostly just syntactic sugar, there is a slight difference in the deSerializeParameters method. Before, if the first type was a subclass of Tuple, the method fetched its type name to then look up the class for that name. However, the class was already loaded and present. So, looking it up again should be a no-op. Reusing the existing clz variable here also prevents a problem in situations with multiple class loaders (e.g. OSGi) where it's not guaranteed that the class can be found by its name.
a09b9b0 to
d100455
Compare
Owner
|
Thanks for your PR. Regarding your question: With "add value" I mean something like:
The only PRs I will refuse, are those which only change things for the sake of changing. Also PRs which are just fixing random typos in documentation without adding anything new and helpful might be refused. So if you have some point you think you can improve - go ahead and provide a PR 😁 |
This file contains hidden or 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
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.
While this is mostly just syntactic sugar, there is a slight difference in the deSerializeParameters method. Before, if the first type was a subclass of
Tuple, the method fetched its type name to then look up the class for that name. However, the class was already loaded and present. So, looking it up again should be a no-op. Reusing the existingclzvariable here also prevents a problem in situations with multiple class loaders (e.g. OSGi) where it's not guaranteed that the class can be found by its name.Btw. I found some more opportunities to do small maintenance work that I would be happy to do, e.g. using
val instanceof Collectioninstead ofCollection.class.isInstance(val), removing some unused local variables, or simplifying some if conditions. I would not touch the architecture. Is that something that you would appreciate or would you rather me not messing around too much?