How to get the name of PsiAnonymousClass?

Answered

In java an Anonymous class has the name parent$number, and I'd like to somehow get that name from PsiAnonymousClass.

But both PsiAnonymousClass.getQualifiedName() and PsiAnonymousClass.getNameIdentifier() return null.

2 comments
Comment actions Permalink

The PSI represents source-level status where anonymous classes do not have a name.

0
Comment actions Permalink

Thanks. I will work around this issue by getting the parents of the anonymous class until I get a normal class and will create the name from it (even if not accurate).

0

Please sign in to leave a comment.