Find if a class extends a specific class or a class that extends that

已回答

Is there a automate way to search if a class extends a specific class or a class that extends that class ?

e.g.

public class A extends B {
}

public class B extends C{
}

I want to see if class A extends class C direct or through another class ( in the example the class B)

0

PsiClass#getExtendsList

-1
Avatar
Permanently deleted user

getExtendsList will give me the class B and then i have to search again if class B extends class C. I wanted to know if is there a better way than searching all the extends hierarchy

0

getExtendsList is a valid solution. You may implement some recursive function that will return you a list of the classes that you're looking for using the specific stop condition - i.e. your namespace.

0

请先登录再写评论。