How to obtain the class and inheritance tree of..
Sorry, newbie question, but I'm stuck:
Given a psiElement (PsiVariable, PsiField, PsiMethod, PsiClass) linked
to a typed java "thing" (variable, field, constant, method), how can I
- obtain the class of the "thing"
- obtain the inheritance tree of the "thing" class
Example 1:
-
Given 'log', I must assert that its class 'MyLogger' extends
org.apache.log4j.Logger
Example 2:
-
Given 'isDebugEnabled()', I must assert that it is, or extends :
org.apache.log4j.Category.isDebugEnabled()
Alain
Please sign in to leave a comment.
"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:bm198v$d0v$1@is.intellij.net...
>
>
>
>
>
>
>
>
>
boolean InheritanceUtil.isInheritor(PsiClass candidateClass, PsiClass
baseClass, boolean checkDeep) {
or
boolean PsiType.isAssignableFrom(PsiType type)
>
>
>
>
>
PsiMethod[] PsiSuperMethodUtil.findSuperMethods(PsiMethod method)
or better InheritanceUtil.isInhertior(((PsiClassType)l.getType()).resolve(),
PsiManager.getInstance(xxx).findClass("org.apache.log4j.Category"), true)
with all necessary checks for nulls.
Thanks Maxim