PsiClass' isAssignableFrom

Does PsiClass have an equivalent to
java.lang.Class.isAssignableFrom(Class cls)?

TIA,
Jon

1 comment
Comment actions Permalink

Jon Steelman wrote:

Does PsiClass have an equivalent to
java.lang.Class.isAssignableFrom(Class cls)?


Classes are not assignable (whatever reflection API says).
Types are. So you will have to create a PsiClassType from PsiClass
(use PsiElementFactory for that), and use isAssignableFrom for them.

Alternatively, there is a PsiClass.isInheritor(), but it is obviously not
equivalent to isAssignable().

Cheers,
Dmitry
--
Dmitry Lomov
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.