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

fixes customizer logic in the GsonGrpcJsonMarshallerBuilder #6146

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AnyRoad
Copy link

@AnyRoad AnyRoad commented Mar 9, 2025

Motivation:

  • JsonFormat.Parser and JsonFormat.Printer classes are immutable and call of any method in customizer of the GsonGrpcJsonMarshallerBuilder creates new object.
  • Because of that result of the customer is ignored so we need a way to use new object created in the customizer.

Modifications:

  • Replaces Consumer which does not return anything with the Function<T, T> customizer which returns customized object.

Result:

  • We can actually customize JsonFormat.Parser and JsonFormat.Printer using the customizer object.

JsonFormat.Parser and JsonFormat.Printer classes are immutable and
calling any method in customizer creates new object.
Because of that result of the customer is ignored so we need a way
to use new object created in the customizer.
Replaces Consumer<T> with the Function<T, T> customizer which
returns customized object.
@CLAassistant
Copy link

CLAassistant commented Mar 9, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Mar 9, 2025

🔍 Build Scan® (commit: d387e3b)

Job name Status Build Scan®

@minwoox
Copy link
Contributor

minwoox commented Mar 10, 2025

Hi, @AnyRoad! Thanks for the PR!
Would you mind:

  • Signing CLA
  • Adding test cases that verities the differences?
  • Adding a new method instead of changing the signature of the existing method which breaks the compatibility?

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.

3 participants