Find KtClass inheritors

Answered

Hi,

Finding inheritors for PsiClass is possible via `DirectClassInheritorsSearch.search(PsiClass)` is there a similar mechanism for KtClass? I've only found `KotlinDirectInheritorsSearcher` but it also recieves PsiClass as search parameter and it's unclear if it's even possible to convert KtClass to PsiClass.

Thanks!

0
2 comments

Hi,
You can use HierarchySearchRequest with searchInheritors() extension. Another way – you can convert `KtClass` to `PsiClass` by `toLightClass()` or `toLightClassWithBuiltinMapping()` extension functions

0

Please sign in to leave a comment.