void (@NotNull InsertionContext context, @NotNull JavaPsiClassReferenceElement item) { JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER.handleInsert(context, item); PsiFile file = context.getFile(); PsiElement elementAt = file.findElementAt(context.getStartOffset()); final PsiElement parentElement = elementAt != null ? elementAt.getParent():null; if (elementAt instanceof PsiIdentifier && (PsiTreeUtil.getParentOfType(elementAt, PsiAnnotationParameterList.class) != null || parentElement instanceof PsiErrorElement && parentElement.getParent() instanceof PsiJavaFile // top level annotation without @ ) && isAtTokenNeeded(context)) { int expectedOffsetForAtToken = elementAt.getTextRange().getStartOffset(); context.getDocument().insertString(expectedOffsetForAtToken, "@"); } if (JavaClassNameInsertHandler.shouldHaveAnnotationParameters(item.getObject())) { JavaCompletionUtil.insertParentheses(context, item, false, true); } }