@NotNull
 public static PsiTypeParameter[] getTypeParameters(@NotNull PsiTypeParameterListOwner owner) {
   final PsiTypeParameterList typeParameterList = owner.getTypeParameterList();
   if (typeParameterList != null) {
     return typeParameterList.getTypeParameters();
   }
   return PsiTypeParameter.EMPTY_ARRAY;
 }
  private static boolean processDeclarationsInMethodLike(
      @NotNull final PsiParameterListOwner element,
      @NotNull final PsiScopeProcessor processor,
      @NotNull final ResolveState state,
      @NotNull final PsiElement place,
      final boolean fromBody,
      @Nullable final PsiTypeParameterList typeParameterList) {
    processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, element);

    if (typeParameterList != null) {
      final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
      if (hint == null || hint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
        if (!typeParameterList.processDeclarations(processor, state, null, place)) return false;
      }
    }

    if (fromBody) {
      final PsiParameter[] parameters = element.getParameterList().getParameters();
      for (PsiParameter parameter : parameters) {
        if (!processor.execute(parameter, state)) return false;
      }
    }

    return true;
  }
 public static int getTypeParameterIndex(
     @NotNull PsiTypeParameter typeParameter, @NotNull PsiTypeParameterList typeParameterList) {
   PsiTypeParameter[] typeParameters = typeParameterList.getTypeParameters();
   for (int i = 0; i < typeParameters.length; i++) {
     if (typeParameter.equals(typeParameters[i])) return i;
   }
   LOG.assertTrue(false);
   return -1;
 }
 public static boolean hasTypeParameters(@NotNull PsiTypeParameterListOwner owner) {
   final PsiTypeParameterList typeParameterList = owner.getTypeParameterList();
   return typeParameterList != null && typeParameterList.getTypeParameters().length != 0;
 }