Skip to content

Allow GsonBuilder to be passed in and used through Analytics and AnalyticsClient #446

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

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

louislepper
Copy link
Contributor

Hi there,

I'm getting some issues when upgrading services to Java 17, where previously Gson was able to automatically deserialise things like java.util.Optional, and java.util.Duration, but now gets exceptions due to disallowed reflection.

Can we change Analytics / AnalyticsClient, to allow the GsonBuilder to be passed in, so that consumers can provide TypeAdapters and TypeAdapter factories as needed, for deserialisation of any classes that they'd like to send in analytics messages?

@louislepper
Copy link
Contributor Author

@pbassut - Does this make sense? Can we do this?

I also wasn't sure why gsonInstance was static - not sure if I'm missing something here.

Copy link
Contributor

@edsonjab edsonjab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All works fine!
could you help us tu run this command to fix format issues on Analytics.java, please?
mvn spotless:apply

@louislepper
Copy link
Contributor Author

All works fine! could you help us tu run this command to fix format issues on Analytics.java, please? mvn spotless:apply

Done 👍

@louislepper
Copy link
Contributor Author

@edsonjab / @pbassut - Can we merge this?

@saidur2k
Copy link

@edsonjab can we merge this branch? It's also blocking us from moving to Java 17.

@louislepper louislepper requested a review from edsonjab August 23, 2023 23:15
@louislepper
Copy link
Contributor Author

@bsneed / @MichaelGHSeg Would either of you be able to review?

@kim5566
Copy link

kim5566 commented Sep 26, 2023

Hey @edsonjab do you have any update on this PR? 🥺

@bsneed
Copy link
Contributor

bsneed commented Sep 26, 2023

Following up internally, stay tuned. Will get an answer this week.

@louislepper
Copy link
Contributor Author

louislepper commented Sep 26, 2023

Hi @bsneed / @wenxi-zeng / @edsonjab

Thanks for the approval. Unfortunately I don't have permission to hit merge - Would one of you be able to?
Screenshot 2023-09-27 at 9 48 47 am

@edsonjab
Copy link
Contributor

Hi @louislepper we will request to merge your PR

@MichaelGHSeg MichaelGHSeg merged commit 4e47e76 into segmentio:master Sep 27, 2023
@MichaelGHSeg
Copy link
Contributor

Released in 3.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants