How to get kotlin class from UParameter type?


I have some code, that searches for usages of some method first parameter type. The code

(uMethod.uastParameters[0] as UVariable).type

returns `PsiClassType`, that resolves to some `ClsClassImpl`. The last is compiled java class, but actually, the type is kotlin class from the same file and it is not compiled. `(uMethod.uastParameters[0] as UVariable).typeReference` returns null. Is it possible to get KtClassOrObject from UVariable type?


Resolved with `com.intellij.psi.PsiElement#getNavigationElement`


`PsiClassType` in case of Kotlin will resolve to `KtLightDeclaration<KtClassOrObject, PsiClass>` from which you can take `kotlinOrigin` which will be your `KtClassOrObject`.


But actually it is little bit strange to have to know to the language of the type you are resolving to