boolean (@NotNull PsiElement element) { if (Statement.isStatementContext(element) || Expression.isExpressionContext(element)) { return false; } PsiElement parent = element.getParent(); if (parent instanceof PsiJavaCodeReferenceElement) { PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiTypeElement && grandParent.getParent() instanceof PsiRecordHeader) { return true; } } return JavaKeywordCompletion.isSuitableForClass(element) || JavaKeywordCompletion.isInsideParameterList(element) || PsiTreeUtil.getParentOfType(element, PsiReferenceParameterList.class) != null; }