Skip to content
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

fix: remove reflection for gson deserilization in GsonTypeHandlerAdapter #4370

Merged
merged 4 commits into from
Jan 4, 2021

Conversation

pollend
Copy link
Member

@pollend pollend commented Jan 3, 2021

these interfaces don't use serializationContext so I just dropped them from deserilization and serilization and use the methods directly.

 this.serializer = (src, typeOfSrc, context) ->
                ((GsonPersistedData) typeHandler.serialize(src, new GsonPersistedDataSerializer()))
                .getElement();

        this.deserializer = (json, typeOfT, context) ->
                typeHandler.deserializeOrNull(new GsonPersistedData(json));

@eviltak eviltak self-requested a review January 4, 2021 17:46
@eviltak
Copy link
Member

eviltak commented Jan 4, 2021

The change seems very reasonable to me, and is what should have been done in the first place. As long as functionality isn't broken (I imagine the only place this is likely to be used is the UI file loader), we can go ahead and merge.

@jdrueckert
Copy link
Member

jdrueckert commented Jan 4, 2021

I tested it in omega and I didn't see any obvious issues. On the contrary, it fixed the

19:06:23.792 [main] ERROR o.t.rendering.nui.asset.UIFormat - Failed to deserialize field skin of notificationOverlay
java.lang.IllegalArgumentException: Cannot find field com.google.gson.Gson.deserializationContext

issue and others of this sort in my "old" omega. In a completely fresh omega workspace I didn't run into those anyway anymore, but there too I don't see any obvious issues.

Not entirely sure, though, how to thoroughly check that the functionality is not broken @eviltak

@jdrueckert jdrueckert changed the title remove reflection for gson deserilization in GsonTypeHandlerAdapter fix: remove reflection for gson deserilization in GsonTypeHandlerAdapter Jan 4, 2021
@jdrueckert jdrueckert merged commit 5370450 into MovingBlocks:develop Jan 4, 2021
@Cervator Cervator added the Topic: Architecture Requests, Issues and Changes related to software architecture, programming patterns, etc. label Jan 4, 2021
@Cervator Cervator added this to the v4.2.0 milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: Architecture Requests, Issues and Changes related to software architecture, programming patterns, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants