-
Notifications
You must be signed in to change notification settings - Fork 27
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
[chore] Remove reflection usage from KiotaSerialization #957
Conversation
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
f72852a
to
9500d3d
Compare
Conflicts have been resolved. A maintainer will take a look shortly. |
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 contribution.
The reflection option was requested by @sebastienlevert in the specification so people don't have to provide the factory method. It's a shorthand for simplicity and since there are overloads accepting the method I don't think it hurts to have those.
They are not used by the generated code.
Thanks for the context @baywet !
If this is the desired outcome I'm convinced they should be removed. Although at first look they provide a "nice to have" API which is slightly nicer than the plain one, the risk of invoking one of those methods and breaking a GraalVM Debugging and understanding the issues with a
Correct, and it's very very little tested too ... If, after these motivations, you still feel strongly about keeping the methods, I want to propose, at least, moving them to a location where the usage of reflection is very very clear, for example changing the package name:
I'm sorry to push a little hard on this, but I have spent quite enough hours of my life debugging those issues 😢.
|
These are most of the arguments I gave to @sebastienlevert + reliability/performance. I'll let you folks discuss that since I'm already in the camp of "we should not be doing any reflection" |
Got it 👍 The resulting API looks cleaner with a more "idiomatic" name like: KiotaSerialization.deserialize(jsonContentType, strValue, TestEntity::deserializer); |
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
In this case @andreaTP if we were to remove the reflection versions of these APIs, would the only thing left on your mind be the |
I would say that no further actions are required around reflection, all the rest falls in the category of "nice to have". |
So current state is OK? Just to make sure I understand correctly? |
Correct, the current status is OK and Kiota is compatible with To avoid introducing breaking changes after GA, I warmly encourage you to approve this PR, and we can move on from there. |
Any update? Should I rebase or this is not going to go in? |
This should go in. I agree with your concerns and better to avoid reflection in this case. @baywet make your magic happen 😁 |
9500d3d
to
87dda24
Compare
Just a heads up on that @sebastienlevert : this means that Java will be different from dotnet. But similar to Go/TS. But I'll proceed. Thanks everyone for the discussion. |
I started picking up #923 again.
Before opening Java to GA I think it makes sense to remove those reflective methods, they look convenient, but I think that a cleaner smaller API is the way to go to start with.
Also, this will prevent accidental usage of reflection on platforms that do not support it completely (like GraalVM native-image).
In case we receive feedback and ask to re-introduce those helpers we can re-evaluate.