boolean (PsiElement position) { if (psiElement().afterLeaf("@").accepts(position) || PsiTreeUtil.getNonStrictParentOfType(position, PsiLiteralExpression.class, PsiComment.class, PsiExpressionCodeFragment.class) != null) { return false; } PsiElement prev = prevSignificantLeaf(position); if (prev == null) { return true; } if (psiElement().withoutText(".").inside( psiElement(PsiModifierList.class).withParent( not(psiElement(PsiParameter.class)).andNot(psiElement(PsiParameterList.class)))).accepts(prev) && (!psiElement().inside(PsiAnnotationParameterList.class).accepts(prev) || prev.textMatches(")"))) { return true; } if (psiElement().withParents(PsiErrorElement.class, PsiFile.class).accepts(position)) { return true; } return isEndOfBlock(position); }