Resolve generic type of PsiClassReferenceType

I got stuck trying to resolve the generic class in order to create a custom lint rule. Let's say I'm parsing this class:

 

interface TestServiceJava {
Flowable<Test> getTest();
void postTest(Test test);
}

I'm interested in finding all the classes referenced in TestServiceJava interface, in this case, it would be just Test. this is what I've tried:

for (PsiMethod psiMethod : uClass.getAllMethods()) {
PsiType returnType = psiMethod.getReturnType();
PsiClass referenceClass = PsiUtil.resolveGenericsClassInType(returnType).getElement();

I thought I would get PsiClass with the reference to Test but it doesn't work, is there any way to get all the references?

Thank you very much.

1

Please sign in to leave a comment.