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?

3 comments
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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

0

Please sign in to leave a comment.