-
Notifications
You must be signed in to change notification settings - Fork 172
fix unwrapGenericType to properly find generic type in arguments Map #361
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 unwrapGenericType to properly find generic type in arguments Map #361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test that would fail without this fix.
36a3756
to
60123dc
Compare
@vojtapol tests added, let me know if they look good. Here's another exception for that particular test in case fix is not in place:
|
@vojtapol @oliemansm pls let me know if you need anything else in order to approve this, my team has a few features depending on this fix and we'd love to ship them. Much appreciated. |
@jdorleans This will make it to the next release. Nothing else is needed. |
1ad07f9
to
e55fd82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution. 🎉
Problem
This PR fixes
GenericType$RelativeTo.unwrapGenericType
method adding the ability to correctly find generic types for a multi-level hierarchy class abstraction. Currently, the following exception occurs in case object is mapped with such case:Method
GenericType$RelativeTo.unwrapGenericType(GenericType.kt:126)
The existing logic, line 125, returns proper types in a Map, but fails to find
type
returning null instead.TypeUtils.determineTypeArguments(getRawClass(mostSpecificType), declaringType)[type]
Expected behavior
unwrapGenericType
should be capable of finding generic types independently of number of class extentions. A > B > CSolution
Filtering the map by matching type names instead of trying to get by type equality solves the problem.