private static @Nullable PsiTypeElement getFirstKey(@NotNull PsiTypeElement typeElement) {
      PsiJavaCodeReferenceElement typeReference = typeElement.getInnermostComponentReferenceElement();
      if (typeReference == null) return null;

      PsiReferenceParameterList parameterList = typeReference.getParameterList();
      return parameterList == null ?
             null :
             getFirstElement(parameterList.getTypeParameterElements());
    }
private static @Nullable PsiTypeElement getFirstKey(@NotNull PsiTypeElement typeElement)