private static boolean typeParameterIsNotValidInTypeElementContext(@NotNull PsiTypeElement parent) {
    PsiElement grandParent = parent.getParent();
    return grandParent instanceof PsiClassObjectAccessExpression ||
           grandParent instanceof PsiDeconstructionPattern ||
           grandParent instanceof PsiPatternVariable ||
           grandParent instanceof PsiInstanceOfExpression;
  }
private static boolean typeParameterIsNotValidInTypeElementContext(@NotNull PsiTypeElement parent)