Checking if outer class has Doc Comments

I am trying to check if there are javadocs on the top of a class , I did something like this  but I am getting it  even for inner classes , is there a better way to solve this.

@Override
public void visitClass(PsiClass aClass) {
boolean hasDocComment = false;
for(PsiElement element :aClass.getChildren()) {
if(element instanceof PsiDocComment) {
hasDocComment = true;
}
}
0

Hi!

aClass.getDocComment() should return the javadoc of a class you have.

Anna

0

请先登录再写评论。