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

Support Properties subclasses in GsonTypes.getMapKeyAndValueTypes #2758

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

panic08
Copy link
Contributor

@panic08 panic08 commented Oct 11, 2024

There is a TODO in this method that calls to test it with the Properties subclasses. They are supposed to return new Type[] {String.class, String.class}, just like if you cast the Properties class itself. But still when you pass a subclass of Properties, such as CustomProperties, the method returns new Type[] {Object.class, Object.class}, which is incorrect. Here I tried to fix this problem by using isAssignableFrom() and also wrote tests which indicate that the problem is solved

@eamonnmcmanus
Copy link
Member

Thanks! This does seem like the sort of thing where existing code might conceivably be depending on the current behaviour. I'll run this against all of Google's internal tests and if nothing fails we can go ahead with the change.

Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

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

I ran this against all of Google's internal tests and there were no failures, so I think it is pretty safe to merge.

@eamonnmcmanus eamonnmcmanus merged commit 7e98ebd into google:main Oct 12, 2024
11 checks passed
@panic08 panic08 deleted the support-properties-subclasses branch October 12, 2024 14:26
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.

2 participants