boolean (ASTNode ancestorNode, ASTNode node) { PsiElement ancestor = BasicJavaAstTreeUtil.toPsi(ancestorNode); PsiElement element = BasicJavaAstTreeUtil.toPsi(node); if (ancestor != null && element != null) { if (PsiTreeUtil.isAncestor(ancestor, element, false)) { if (PsiTreeUtil.hasErrorElements(ancestor)) return false; return true; } } return false; }