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 GenericConversionService selects incorrect converter #34697

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

belljun3395
Copy link

@belljun3395 belljun3395 commented Apr 1, 2025

Fix gh-34685

This method is implemented to determine type compatibility between ResolvableType instances,
not only by comparing raw types but also by recursively checking deep assignability of generic types.
An alternative approach could be using TypeDescriptor.isAssignableTo.
I would appreciate your review and feedback on this.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 1, 2025
@belljun3395 belljun3395 force-pushed the fix-genericConversionService-selects-incorrect-converter branch 5 times, most recently from 54735a9 to ca4b8ab Compare April 1, 2025 07:18
@belljun3395 belljun3395 marked this pull request as draft April 2, 2025 04:18
@belljun3395 belljun3395 force-pushed the fix-genericConversionService-selects-incorrect-converter branch 4 times, most recently from 7708162 to fc79b0c Compare April 2, 2025 05:52
@belljun3395 belljun3395 force-pushed the fix-genericConversionService-selects-incorrect-converter branch from fc79b0c to 5c35930 Compare April 2, 2025 05:53
Comment on lines +362 to +364
private boolean isAssignableTo(ResolvableType expected) {
return isAssignable(this.targetType, expected);
}
Copy link
Author

Choose a reason for hiding this comment

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

If use TypeDescriptor.isAssignableTo

private boolean isAssignableTo(TypeDescriptor targetType) {
	TypeDescriptor converterTargetType = new TypeDescriptor(this.targetType, this.targetType.toClass(), null);
	return converterTargetType.isAssignableTo(targetType);
}

@belljun3395 belljun3395 marked this pull request as ready for review April 2, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GenericConversionService selects incorrect converter for String to List<String> conversion
2 participants