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

Add a method that checks if a given Type is a super-type of another #31

Open
kaqqao opened this issue Jun 22, 2016 · 2 comments
Open

Add a method that checks if a given Type is a super-type of another #31

kaqqao opened this issue Jun 22, 2016 · 2 comments

Comments

@kaqqao
Copy link

kaqqao commented Jun 22, 2016

When dealing with Types and not Classes, it's rather hard to tell if a given type is a super- (or sub-) type of another, as there is no equivalent to Class#isAssignableFrom.
GentyRef has a method for this, GenericTypeReflector.isSuperType(superType, subType), but that lib is rather outdated and seems unmaintained, and it generally doesn't make sense to add another type resolution lib.

@cowtowncoder
Copy link
Member

@kaqqao Sounds reasonable, just need to figure out where to put that in an API, and whether to do "same or supertype" or strict "is supertype", as well as combinations (maybe allow Class<?> argument and resolved one).

@cowtowncoder
Copy link
Member

I do not remember the background here, but it would seem to me that this relationship could be relatively easily be determined by comparing "raw classes" of two types, no?
(this wouldn't verify generic type compatibility but should otherwise work fine)

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

No branches or pull requests

2 participants