-
Notifications
You must be signed in to change notification settings - Fork 15
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
Type parameters don't resolve when enclosing class has a type parameter #16
Comments
pretty ping? |
Hey! I'll have a look at this today. Btw, GeantyRef has |
Ok, seems I was right. The issue is in the way protected TypeCapture() {
ParameterizedType superType = (ParameterizedType) getClass().getGenericSuperclass();
this.type = superType.getActualTypeArguments()[0];
} With that, the test will pass. The long of it is that class StringList extends ArrayList<String> {} and call In your case, the anonymous inner class is a subtype of I think I could implement partial super type resolution, e.g. |
Thank you for the explanation. We don't specifically need a method to handle this use case, it was just surprising to get such a non-specific result. If you think it would be useful to have in the API, we certainly would love to use it, but are happy enough with the code as it is. We ship our own TypeToken type in Jdbi because we want to allow our users to pass in type tokens without exposing geantyref as part of our public API. |
Hi @kaqqao , we ran into some behavior that we don't understand over at jdbi/jdbi#2306
This code works as you'd expect when the enclosing class
Foo
has no type parameter - but when you introduce a parameterFoo<T>
, suddenly the type parameter is lost in the TypeCapture class and this test fails.Is this a bug in GeAnTyRef, or are we perhaps using it incorrectly? Thank you!
The text was updated successfully, but these errors were encountered: