boolean (@NotNull PsiJavaCodeReferenceElement element) { PsiTypeElement type = SyntaxTraverser.psiApi().parents(element).filter(PsiTypeElement.class).last(); PsiElement prev = FilterPositionUtil.searchNonSpaceNonCommentBack(type); PsiTypeParameterList typeParameterList = PsiTreeUtil.getParentOfType(prev, PsiTypeParameterList.class); if (typeParameterList != null && typeParameterList.getParent() instanceof PsiErrorElement) { return ContainerUtil.exists(typeParameterList.getTypeParameters(), p -> Objects.equals(element.getReferenceName(), p.getName())); } return false; }