How to find anonymous classes in PsiClass?

I have a PsiClass.
Is it possible to retrieve all anonymous classes that are being created in that PsiClass?

The getInnerClasses() and getAllInnerClasses() methods only return non-anonymous inner classes if I'm not mistaken?

0
3 comments
Avatar
Permanently deleted user

The only way I know is to create a PsiRecursiveElementVisitor, override visitAnonymousClass, and then call class.accept with that visitor.

Sixth and Red River Software
"Code with Grace and Verve

0
Avatar
Permanently deleted user

That's what I'm doing to find all anonymous classes:

0
Avatar
Permanently deleted user

Thanks a lot guys, I'll give this a try.

0

Please sign in to leave a comment.