boolean (PsiCodeBlock block) { PsiElement[] children = block.getChildren(); for (PsiElement child : children) { if (child instanceof PsiComment) return false; if (!(child instanceof PsiWhiteSpace) && !(child instanceof PsiJavaToken)) return false; } return true; }